Jump to content


Photo

help with php/mysql


  • Please log in to reply
2 replies to this topic

#1 snake310

snake310
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 21 August 2006 - 08:08 AM

Hello

  cAn anyonr help me have a problem with writing to a mysql database with php

<?php
$query = "INSERT INTO asus ";
    $query .= "(model, serial, ";
    $query .= "InTime, provider) ";
    $query .= " VALUES(a8n,123545,545464,45646)";
    mysql_pconnect("localhost","root")
                  or die("Unable to connect to SQL server");
    mysql_select_db("motherboards") or die("Unable to select database");
    mysql_query($query) or die("Insert Failed!");

?>
Anyone hase any idea?
btw just the query has error the connection workes perfectly

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 21 August 2006 - 08:40 AM

you need single quote around values like this:

$query .= " VALUES('a8n','123545','545464','45646')";

Life's too short for arguing.

#3 snake310

snake310
  • Members
  • PipPip
  • Member
  • 17 posts

Posted 21 August 2006 - 08:42 AM

thx...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users