Help with PHP

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I'm learning php. I want to do a thing in php. Visitors to my site should be able to send their site to my site. Then the 10 most recent submitted link will show up under it. I thought of using php and mysql. I want to do that in the sql table there only will be 10 links and when it comes a new one the oldest will be deleten. Plz don't post any finished script since I want to learn on my own. I thought of using POST and GET functions (I've readed about them in a php book) but I'm not sure exactly how to use them and how to make it connect and submit it to an table in my database and make the last one disappear.
 

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
Since you dont want finished scripts I'm just going to give you some practical tips.
You want the database to store just 10 url's.
Thats not too hard, just give the table a submition date and time field.
Find the oldest and replace that record with the newly submitted url and the current date and time.

As for the submition itself, you would indeed have to use POST or GET.
Wich one you pick is upto you. (POST would be preferable for not showing in the url and allowing larger values)
The way they both work is through a form.(wich is html)
Once the form is submitted you can retrieve it in php with $_POST['name'] or $_GET['name'].
Another thing of interest with it is the isset(); function.
To make sure you wont get any anoying errors.
 

nigel91

New Member
Messages
43
Reaction score
0
Points
0
I would suggest looking to download something off the web, that is ready made.
 

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
I would suggest looking to download something off the web, that is ready made.
As a mater of facts, I wouldn't for learning its best to just start and run into problems.
In wich case google around for a solution and move on.
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I start with the sql... How many columns should it have?

Edit: Eh just post an finished script then I maybe can study it and learn from it.
 
Last edited:

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
The table could be like this:
urlList(url,date,time)
You could include descriptions and stuff like that but thats upto you.
Also you should read up on how to handle sql queries in php.
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
I get this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'date,time)' at line 1

I wrote CREATE TABLE urllist (url,date,time)

I tested this too:

CREATE TABLE 'urllist' (
'url',
'date',
'time'
);

But that didn't work either.
 
Last edited:

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
No need to set it up with php, goto your cPannel, add a database and user.
Link them.
Go to phpMyAdmin and create the table from there.
You can also execute queries there.

The ony way you would need it is if you want to publish your code and create an install.php file.
In wich case: http://www.1keydata.com/sql/sqlcreate.html
There is the correct syntax.
 
Last edited:

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
Ok I managed to add this:

1-2.png


Can you please write the php script now. I will study it and maybe learn something :)
 

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
If you want to just have the code done for you then I gues your just gonna have to post it in the marketplace.
Or just pay me 200 credits right away and i'll do it for you.
 
Top