Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Help

Post by jauson »

Hi Guys,

I created a view and modify form.
table name: `t_board`
fields:

index <-- hidden
writer <-- on my form
subject <-- on my form
message <-- on my form
filename <-- on my form
dateRegister <-- hidden

when i click modify button in view form I need to see what data registered being modify by index. here's my script on modify form.

Code: Select all

$index=$_GET['index'];

$sql = "SELECT * FROM `t_board` WHERE index='$index'"; <---- not working Any help will be appreciated
$result = mysql_query($sql);

<? while($rows = mysql_fetch_array($result)){
?>

echo $rows['writer'];
echo $rows['subject'];
echo $rows['message'];
echo $rows['filename'];
Last edited by Benjamin on Thu Oct 06, 2011 5:25 am, edited 1 time in total.
Reason: Added [syntax=php|sql|css|javascript] and/or [text] tags.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Help

Post by social_experiment »

Code: Select all

<?php
$result = mysql_query($sql) or die(mysql_error());
?>
The query itself won't report an error so you check for it when passing the query to mysql_query() by using the die() function. Add the example line into your script and paste the results back here :)

Tip: It helps to be thorough when asking for help, giving as much information about the error / problem usually results in a speedy solution to the problem or error.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply