Jump to content

Recommended Posts

Hello,

 

I am not exactly sure what i'm doing wrong here, but I am trying to make mysql find the specific user with a select statement, and then insert data about this user into his record. This is my code

//this top connection part is not the problem, it's after the brown

$qry = "INSERT INTO products

(productid, productname, telefone, fetchaalta, fetchabaja, clientid)

VALUES

('$_POST[productnumber]', '$_POST[productname]', '$_POST[telefone]', '$_POST[desde]', '$_POST[hasta]', '$_POST[clientid]')";

 

 

 

 

if (!@mysql_query ($qry)) {

die(mysql_error());

}

else {

 

$client = $_POST[cliente];

 

 

$getuser = 'SELECT id FROM login WHERE id = '$client'';

 

if ($r = mysql_query ($getuser)) {

 

while ($row = mysql_fetch_array ($r)) {

//Create INSERT query

$query = "INSERT INTO login

(fetchaalta, fetchabaja)

VALUES

('$_POST[altacliente]', '$_POST[bajacliente]')";

if (!@mysql_query ($query)) {

die("possible problem here".mysql_error()."problem in loginquery");

}

}

}

else {

 

 

header("location: admin_menu.php");

exit;

}

}

I am getting the dreded parse error, unexpected T_Variable, but the main problem is i'm pretty sure my logic is not right, and I am wondering how to go about setting this up

iif anyone is good with mysql logic it would be a great help to me, thanks in advance!

First of all make sure that ur php variable are interpreted and if not , try this

VALUES ('{$_POST['productnumber']}',..............)

 

is this what u r looking for  ur second insert query

INSERT INTO login   (fetchaalta, fetchabaja)   VALUES   ('$_POST[altacliente]', '$_POST[bajacliente]') where id=ANY (SELECT id FROM login WHERE id = '$client')

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.