Jump to content

Data from the database..


adam1991

Recommended Posts

Elo im new here, sorry if this is in the wrong section apologies if it is!

 

Now.. I have a homepage and a admin page there is a form in the admin page that changes the information on the homepage, ive got that all set up now ive got the information to show on the homepage but when i want to change the information on the homepage again it still shows the old message, and creates a NEW entry, ive tried UPDATE but just get errors if i change anything.. i will post my MYSQL code incase Y'all need it :)

 

$result = mysql_query("SELECT * FROM `message")

or die(mysql_error()); 

 

$result = mysql_query("DELETE FROM `phptest`.`message` WHERE `message`.`id` IS NULL LIMIT 1;")

or die(mysql_error());

 

$result = mysql_query("SELECT * FROM `message` WHERE 1")

or die(mysql());

 

As you can see i also tried the DELETE function aswell but that just deletes all the entrys, so thats wrong aswell..

 

Hope i have made some sense if not ill rephrase it some how lol

 

thanks for the help :)

 

Adam

Link to comment
https://forums.phpfreaks.com/topic/156122-data-from-the-database/
Share on other sites

$result = mysql_query("UPDATE `phptest`.`message` SET `message` = 'This is the message that will appear on the homepage' WHERE `message`.`id` =1 LIMIT 1 ;")

or die(mysql_error())

 

The error what i got just field up the whole page with crap about php and server error, it doesnt go away till u correct the code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.