saad|_d3vil Posted August 23, 2008 Share Posted August 23, 2008 hi i am new here first of all hi and i need help in php code i have just make table in database sql now what i put code for insert table in to website and other is that how i make hyper link for sql database table in php code Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/ Share on other sites More sharing options...
DeanWhitehouse Posted August 23, 2008 Share Posted August 23, 2008 Hey , and welcome to the site. Do you know any PHP Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-623853 Share on other sites More sharing options...
DarkWater Posted August 23, 2008 Share Posted August 23, 2008 ...What? o-O Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-623870 Share on other sites More sharing options...
DeanWhitehouse Posted August 23, 2008 Share Posted August 23, 2008 I think he wants to create a table, then insert data into it, and then display it. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-623880 Share on other sites More sharing options...
Lamez Posted August 23, 2008 Share Posted August 23, 2008 hi i am new here first of all hi and i need help in php code i have just make table in database sql now what i put code for insert table in to website and other is that how i make hyper link for sql database table in php code  Translation: Hi I am new here. First of all, hi and I need help with my php code. I just made a table in the database, how do I use the insert query on my website? Other question is, how do I make a hyper link to the database table in my php code?  I think that is what he is say... Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-623923 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 see my page i make database table now i want to know that how i make hyperlink see this page http://www.apnimuskaan.com/sadasdas.php here is my sql database table now how i make hyperlink Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624176 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 see my page i make database table now i want to know that how i make hyperlink see this page http://www.apnimuskaan.com/sadasdas.php here is my sql database table now how i make hyperlink You'll have to echo (or print) the necessary HTML in your code, eg echo '<a href="/path/to/page.ext">This is a link</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624179 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 where i put this code and i want to make link with id how i make? for example http://www.apnimuskaan.com/sadasdas.php?=id2 i want to make like this how i make Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624223 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 where i put this code and i want to make link with id how i make? for example http://www.apnimuskaan.com/sadasdas.php?=id2 i want to make like this how i make How would I know! You'll need to post your code and than we can suggest what you should do Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624224 Share on other sites More sharing options...
MasterACE14 Posted August 24, 2008 Share Posted August 24, 2008 <?php echo "<a href=\"page.php?id=" . $_GET['id'] . "\">Link</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624225 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 THANKS YOU ALL BUT NOW THERE IS ONE MORE PROBLEM IS THAT I DO NOT WANT TO CHANGE THE PAGE I WANT THAT IF SOME ONE CLICK ON THE PAGE SO THE PAGE KEEP SAME AND THE SQL DATABASE TABLE GET CHANGE HOW I DO THAT Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624245 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 What your saying isnt making sense, and loose the caps lock. Please post the code you have , and the question and we will try and help. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624247 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 thi is my coding <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } Â mysql_select_db("my_db", $con); Â $result = mysql_query("SELECT * FROM album"); Â while($row = mysql_fetch_array($result)) { echo $row['name'] . " " . $row['age']; echo "<br />"; } Â mysql_close($con); ?> i have put this code now i want to know how i make hyperlink so people who click on the hyperlink it goes to other table of my database but on same page but the id of the change my website link is this http://www.apnimuskaan.com/sadasdas.php Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624248 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) Â { Â die('Could not connect: ' . mysql_error()); Â } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_array($result)) Â { Â echo $row['name'] . " " . $row['age']; echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; Â } mysql_close($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624254 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 no it is working but the url is this http://www.apnimuskaan.com/sadasdas.php?id= there is no id now what i do see this page http://www.apnimuskaan.com/sadasdas.php Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624264 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 are you using the updated one  <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con)  {  die('Could not connect: ' . mysql_error());  } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM album"); while($row = mysql_fetch_array($result))  {  echo $row['name'] . " " . $row['age']; echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'";  } mysql_close($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624265 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 no it is working but the url is this http://www.apnimuskaan.com/sadasdas.php?id= there is no id now what i do see this page http://www.apnimuskaan.com/sadasdas.php Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624268 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 thats because you need to put whatever you want it to be there. I added $row['id']; as an example. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624272 Share on other sites More sharing options...
sasa Posted August 24, 2008 Share Posted August 24, 2008 change echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; to echo "<a href='?id=".$row['id']."'>".$row['name']."</a>'"; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624275 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 thnks for pointing that out , sasa. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624277 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 plz what i change in this code for makeing hyper link echo "<a href='?id='".$row['id']."'>".$row['name']."</a>'"; Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624418 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 That code does create a hyperlink! I understand you want to create a link which links to http://www.apnimuskaan.com/sadasdas.php?id= however what I dont understand is what you want ?id= set to? You need to change $row['id'] to whatever you want the ?id= set to. Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624429 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 i write this code <?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_array($result)) { echo $row['name'] . " " . $row['age']; echo "<a href='?id='".$row['1']."'>".$row['age']."</a>'"; } Â mysql_close($con); ?> but it is not working see this page http://www.apnimuskaan.com/sadasdas.php Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624430 Share on other sites More sharing options...
saad|_d3vil Posted August 24, 2008 Author Share Posted August 24, 2008 i also want to know where we can see that what is the id? Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624431 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 The variable $row['id'] corresponds to the id field in your album table, What field do you to be part of your link? Quote Link to comment https://forums.phpfreaks.com/topic/121018-solved-need-help-in-php-code/#findComment-624435 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.