saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 1 1 1 2 1 3 1 7 1 8 this is my id filed ids now what i wrung in my coding Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624438 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 Change your code to <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_assoc($result)) { echo "<pre>".print_r($row, true)."</pre>"; echo $row['name'] . " " . $row['age']; echo "<a href='?id='".$row['id']."'>".$row['age']."</a><br />'"; } mysql_close($con); ?> And post the output here. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624439 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 Array ( [id] => 1 [name] => Timmy Mellowman [age] => 23 ) Timmy Mellowman 2323 ' Array ( [id] => 2 [name] => Sandy Smith [age] => 21 ) Sandy Smith 2121 ' Array ( [id] => 3 [name] => Bobby Wallace [age] => 15 ) Bobby Wallace 1515 ' Array ( [id] => 7 [name] => [age] => 0 ) 00 ' Array ( [id] => 8 [name] => [age] => 0 ) 00 ' Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624441 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 Change echo "<a href='?id='".$row['id']."'>".$row['age']."</a><br />'"; to echo '<a href="?id='.$row['id'].'">'.$row['age'].'</a><br />'; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624444 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 now the link is changing but the page is not changing now what i want to do for change page i want to make new table? Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624447 Share on other sites More sharing options...
sasa Posted August 24, 2008 Share Posted August 24, 2008 can some explain me in detail please what i change in this code for makeing hyper link echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; remowe one ' after = after click link in variable $_GET['id'] is value of id Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624449 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 You need to add more code to display a new page, eg <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); // check to see if id is set if(isset($_GET['id']) && is_numeric($_GET['id'])) { echo 'Your have requested ID #'.$GET['id'].'<br />'; echo '<a href="sadasdas.php">Back</a>'; } // no id requested, display results else { $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_assoc($result)) { echo '<a href="?id='.$row['id'].'">'.$row['age'].'</a> - ' . $row['name'] . " - " . $row['age'] . '<br />'; } } mysql_close($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624451 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 can some explain me in detail please what i change in this code for makeing hyper link echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; remowe one ' after = after click link in variable $_GET['id'] is value of id where i put this code Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624452 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 can some explain me in detail please what i change in this code for makeing hyper link echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; remowe one ' after = after click link in variable $_GET['id'] is value of id where i put this code No need to do that, I have already fixed that. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624455 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 Your have requested ID # Back it is showing this how i custom change each id Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624456 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 Sorry made a mistake in my code echo 'Your have requested ID #'.$GET['id'].'<br />'; Needs to be echo 'Your have requested ID #'.$_GET['id'].'<br />'; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624459 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 I would advise you to read some PHP tutorials , and learn stuff. As we are not here to write all the code for you, and it helps you fix small errors like the one with the $_GET statement. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624461 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 now if i want to make my custom page for id how i can make? Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624462 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 sorry i am realy sorry i disturb you again and again plz tell me this only plz now i will not ask on Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624463 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 http://www.tizag.com/phpT/ http://www.w3schools.com/PHP/ Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624464 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 now if i want to make my custom page for id how i can make? I have already have shown you! DO you understand any of the code used? If you dont then you should read the PHP manual. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624465 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 only tell me that what it call to change the page so i will learn in http://www.tizag.com/phpT/ Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624466 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 What do you want to happen when the user clicks the link? You really are pushing your limit. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624467 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 ok bye sorry i disturb you all bye sorry again Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624468 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 If thats all , click solved. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/page/2/#findComment-624491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.