Jump to content

[SOLVED] need help in php code


saad|_d3vil

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="/https/forums.phpfreaks.com/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

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.