Jump to content

[SOLVED] dynamic SQL statement


dennismonsewicz

Recommended Posts

hmm thanks for the help...

 

i am writing a SQL file can you use this in the file?

 

like:

 

INSERT INTO `table` (`field1`) VALUE ('something');

INSERT INTO `table` (`field1`) VALUE ('something') WHERE mysql_insert_id();

mysql_insert_id is php, so its easier to write this in php

 

$query = "INSERT INTO `table` (`field1`) VALUE ('something', 'somethingelse')";
$result = mysql_query($query) or die(mysql_error());
$returnid = mysql_insert_id();
$query = "INSERT INTO `table` (`field1`, `field2`) VALUE ('something', '$returnid')";
$result = mysql_query($query) or die(mysql_error());

ah gotcha... i am writing a Joomla (BOOOO) component and to install the file you have to write a sql file to install of the content and menu structure and its a pain in the butt. And the Joomla Forums suck! You can never get any help!

 

Thanks for your help here man!

Archived

This topic is now archived and is closed to further replies.

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