Php To Mysql?
RSS

Php To Mysql?

Category: FAQ   Time: 2009-12-30   Tags:

I have a wesite with godaddy.com they provide myPHPadmin, the database and table were created easily.
Now, I’m trying to make a form that the end result is to have my form entered data be placed into my databases (gallinks) table (Links).
I have this and get no errors, however the information isn’t showing up in myPHPadmin or even when I export the information in .CSV.
$username=”*************”;
$password=”*************”;
$database=”gallinks”;
$hostname=”*************”;
$name=$_POST['name'];
$date=$_POST['date'];
$url=$_POST['url'];
$desc=$_POST['desc'];
$pic=$_POST['pics'];
mysql_connect($hostname,$username,$pas…
@mysql_select_db($database) or die(”This did not work, eh”);
$query=”INSERT INTO `links` (`name`, `date`, `url`, `desc`, `pic`) VALUES (”,’$name’, ‘$date’, ‘$url’, ‘$desc’, ‘$pic’)”;
mysql_query($query);
mysql_close();
Besides the opening and closing php tags, can anyone see if what could be wrong?
Thanks

Next: Domain Name Question?
Previous: If I Turn On Url Forwarding For My Domain Name, Will I Still Still Recieve My Pop3 Email That Is Sent?
"Php To Mysql?" was posted on Wednesday, December 30th, 2009 at 3:30 pm.

3 Responses to “Php To Mysql?”
  1. Robi Pasaka(2009-12-30):

    the query is
    $query=”INSERT INTO links (name, date,url,desc,pic) VALUES (”$name”,”$date”,”$url”,”$desc”,…
    try it that work.

  2. ajreal(2009-12-30):

    $str = ”;
    foreach ($_POST as $key=>$val) {
    $str.= “{$key}=”";
    $str.= mysql_escape_string($val);
    $str.= “”,”;
    }
    $db = DATABASE_NAME;
    $sql= “INSERT INTO $db.links SET “.substr($str, 0, -1);

  3. Jen(2009-12-30):

    I think you’re not supposed to have single quotes around the table name ‘links.’ I’m not an expert though.

Leave a Reply

 
Recent Posts
Random Posts