Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread tamouse mailing lists
On Mon, Aug 27, 2012 at 8:03 PM, David McGlone wrote: > I got it. All I needed to do was change $_POST[image] to $image in my query > like so: > mysql_query ("INSERT INTO inventory(image, year, make, model, milage, price) > VALUES('$image', '$_POST[year]', '$_POST[make]', > '$_POST[model]', '$_P

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread David McGlone
On Monday, August 27, 2012 05:15:26 PM Matt Pelmear wrote: > You are probably having problems with "Array[name]" because of the way > you are inserting variables into the query. > > You're doing this: > "this is my string with '$_POST[image][name]'." > > Instead, try this: > "This is my string wi

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread Matt Pelmear
You are probably having problems with "Array[name]" because of the way you are inserting variables into the query. You're doing this: "this is my string with '$_POST[image][name]'." Instead, try this: "This is my string with '{$_POST['image']['name']}' in it." or this: "This is my string with

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread David McGlone
On Monday, August 27, 2012 07:47:18 PM Robert Palmer wrote: > Try $_FILES['image']['name']; I tried this, as Matt Pelmear suggested. It somewhat works, it adds Array[name] into the database instead of the image name. > > But are you trying to load the name of the image or the image itself > int

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread David McGlone
On Monday, August 27, 2012 03:36:41 PM Matt Pelmear wrote: > David, > > Try using $_FILES['image']['name'] (like you do elsewhere in the script) > instead of $_POST['image'] ? I just your tried suggestion and now it does insert something into the database, but it's inserting "Array[name]" inste

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread David McGlone
On Monday, August 27, 2012 10:11:32 PM lists-php wrote: > Original Message > > > Date: Monday, August 27, 2012 06:04:28 PM -0400 > > From: David McGlone > > To: php-db@lists.php.net > > Subject: [PHP-DB] Wow, this is weird > > > > Hi Everyone > > > > I have written som

Re: [PHP-DB] Wow, this is weird

2012-08-27 Thread Matt Pelmear
David, Try using $_FILES['image']['name'] (like you do elsewhere in the script) instead of $_POST['image'] ? Also, if you're not just doing a simple test script, you should probably use mysql_real_escape_string() on your parameters in the query. You may want to also look at the alternative

Re: [PHP-DB] Comma separated list

2012-08-27 Thread David McGlone
On Saturday, August 25, 2012 10:19:20 PM Karl DeSaulniers wrote: > $errors = ""; > foreach($_POST as $key=>$val) { > if(empty($val)) { > $errors .= "Please enter ".$key.""; > } > } > if($errors !== "") { //or check string length here > return $errors; > } else { > ..