Jump to content

Recommended Posts

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...

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>';

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

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

<?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);
?>

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);
?>

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.