Jump to content

Recommended Posts

Hi!

I cant figure out what i am doing wrong on this part in my php script.

[php:1:312fb693e6]<?php

mysql_connect($db_host, $db_name, $db_password) OR DIE (\"Konnte nicht mit MySQL verbinden.\");

@mysql_select_db($db_name) OR DIE (\"Konnte nicht mit Datenbank auf MySQL verbinden.\");

$res = mysql_query (\"SELECT * FROM taskoverview\");

$numberRows = mysql_num_rows($res);

for ($i = 0; $i < $numberRows; $i++)

{

$d_name = $_POST[\"name$i\"];

$d_beschreibung = $_POST[\"beschreib$i\"];

$d_duedate = $_POST[\"duedate_value$i\"];

$d_aufwand = $_POST[\"aufwand_table$i\"];

$d_status = $_POST[\"status_table$i\"];

$d_verantwortlich = $_POST[\"verantwort$i\"];

mysql_query (\"UPDATE taskoverview SET name=$d_name, beschreibung=$d_beschreibung, duedate=$d_duedate, aufwand=$d_aufwand, status=$d_status, verantwortlich=$d_verantwortlich)\");

}

?>[/php:1:312fb693e6]

 

$db_host, $db_name, $db_password are definetely set correctly.

the name of the table \"taskoverview\" exists and is spelled correctly.

and all the $_post variables are there. I checked them with some echo messages.

I get no error which makes me post it here.

Once again, id be greatful for help!!!

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/972-update-problem/
Share on other sites

This may sound a lttle basic but I do like to assign variables to all my MySQL statements - if purely for error checking!

 

But the only thing I woulkd alter in the update query is to place each variable into single quotes \'$foo\'......

 

mysql_query (\"UPDATE taskoverview SET name = \'$d_name\', beschreibung = \'$d_beschreibung\', duedate = \'$d_duedate\', aufwand = \'$d_aufwand\' , status = \'$d_status\', verantwortlich = \'$d_verantwortlich\')\");

Link to comment
https://forums.phpfreaks.com/topic/972-update-problem/#findComment-3288
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.