Jump to content

cefalufr

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cefalufr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=371367:date=May 4 2006, 04:36 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 4 2006, 04:36 PM) [snapback]371367[/snapback][/div][div class=\'quotemain\'][!--quotec--] echo the query and then copy/paste it directly into phpmyadmin see if it inserts the row without issues. also, changing this: ...or die('Failed Insertion For New User'); to this: ... or die(mysql_error()); will give you better help for what's wrong. [/quote] Thks. Never thought of checking. Wrong column name for userid!
  2. It Keeps Failing on insertion, someone point of my error? DB information is above this code btw! [code]$fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $state = $_REQUEST['state']; $state = $_REQUEST['city']; $zip = $_REQUEST['zip']; $userid = $_REQUEST['userid']; $query= 'INSERT INTO shipping_multiple (fname, lname, state, city, zip, userid) VALUES ("'.$fname.'","'.$lname.'","'.$state.'","'.$city.'","'.$zip.'","'.$userid.'")'; mysql_query($query) or die('Failed Insertion For New User');[/code] [code] $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $state = $_REQUEST['state']; $city = $_REQUEST['city']; $zip = $_REQUEST['zip']; $userid = $_REQUEST['shipping_multiple']; echo $fname; echo $lname; echo $state; echo $city; echo $zip; echo $userid; $query= 'INSERT INTO shipping_multiple (fname, lname, state, city, zip, userid) VALUES ("'.$fname.'","'.$lname.'","'.$state.'","'.$city.'","'.$zip.'","'.$userid.'")'; mysql_query($query) or die('Failed Insertion For New User');[/code] It Echo's Back the Forms Variables perfectly but fails on insertion
  3. I tried using Dreamweaver to handle PHP Database Coding for about 2 days. Dont. Its horrible. Its better off learning how to do it.
  4. [code]<?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'this'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'oscommerce_feedyoursoul'; mysql_select_db($dbname) or die('Failed to Select database'); ?> <?php $connect = 'SELECT * FROM `shipping_multiple`'; mysql_query($connect) or die('failed query: ' . $connect . '<br>' . mysql_error()); $num_rows = mysql_num_rows($connect); $i = '0' ?> <SELECT name="product" size="5" multiple> <OPTION SELECTED> <?php while($i < $num_rows) {   $firstname = mysql_result("fname");   $lastname = mysql_result("lname");   echo $firstname . $lastname; } ?>[/code]
  5. [!--quoteo(post=371069:date=May 3 2006, 04:55 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 3 2006, 04:55 PM) [snapback]371069[/snapback][/div][div class=\'quotemain\'][!--quotec--] Modify the "or die" clause on the mysql_query statement to output the mysql_error() and the query. [code]<?php $connect = 'SELECT fname lname FROM shipping_multiple'; mysql_query($connect) or die('failed query: ' . $connect . '<br>' . mysql_error()); ?>[/code] I believe you're missing a comma between the field names in your query. Ken [/quote] Still Same Error, This is so annoying. [code]<?php $connect = 'SELECT `fname` ,`lname` FROM shipping_multiple'; mysql_query($connect) or die('failed query: ' . $connect . '<br>' . mysql_error()); $num_rows = mysql_num_rows($connect); $i = '0' ?>[/code]
  6. I keep recieving this Error = [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource ....[/quote] Help? Also My DB Connection is above this code. The query returns no errors, I has to do with the num_rows. [code]<?php $connect = 'SELECT fname lname FROM shipping_multiple'; mysql_query($connect) or die('failed query'); $num_rows = mysql_num_rows($connect); $i = '0' ?> <SELECT name="product" size="5" multiple> <OPTION SELECTED> <?php while($i < $num_rows) {   $firstname = mysql_result("fname");   $lastname = mysql_result("lname");   echo $firstname . $lastname; } ?> </OPTION></SELECT></FORM>[/code]
×
×
  • 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.