| | |
generating random id and save it into db
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
dear frnds,
i hace wrote this code to generate unique id for questionnaire and a query to save it into database with two more value (response id and date)
individually i have checked and unique id function is working.
even insert query is also executing correctly.
but when i put it whole into my php file it doesnt save values into DB.
please help to sort it out. i m in hurry.
code is here:
i hace wrote this code to generate unique id for questionnaire and a query to save it into database with two more value (response id and date)
individually i have checked and unique id function is working.
even insert query is also executing correctly.
but when i put it whole into my php file it doesnt save values into DB.
please help to sort it out. i m in hurry.
code is here:
php Syntax (Toggle Plain Text)
$que_id = uniqid(que); echo $que_id; echo "<br>"; $db->query("INSERT INTO tbl_CT_Responses (Response_ID,Questionnaire_ID,Response_Date) VALUES (".GetSQLValueString("",`int`)."," .GetSQLValueString($que_id,`int`)."," .GetSQLValueString(date('Y-m-d'),`date`) .")"); echo "The questionnaire ID is inserted successfully"; ?>
Last edited by peter_budo; Dec 3rd, 2008 at 6:53 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Jul 2005
Posts: 78
Reputation:
Solved Threads: 3
Why don't you generate some MD5 hash for random numbers yourself ?
Chris, Director, Chrisranjana.com
Web developers and software programmers.
Web developers and software programmers.
you should try echoing the query first just to check that it really works out
php Syntax (Toggle Plain Text)
echo "INSERT INTO tbl_CT_Responses (Response_ID,Questionnaire_ID,Response_Date) VALUES (".GetSQLValueString("",`int`)."," .GetSQLValueString($que_id,`int`)."," .GetSQLValueString(date('Y-m-d'),`date`) .")"
:: xarz ::
have you to tried to check the mysql errors?
or an alternative to the insert statement
hope it will work out for you.
php Syntax (Toggle Plain Text)
echo mysql_error();
or an alternative to the insert statement
php Syntax (Toggle Plain Text)
$db->query("INSERT INTO tbl_CT_Responses SET Response_ID=".GetSQLValueString("",`int`).", Questionnaire_ID=".GetSQLValueString($que_id,`int`).", Response_Date=".GetSQLValueString(date('Y-m-d'),`date`)." ");
hope it will work out for you.
:: xarz ::
i spotted something also which perhaps can solve your problem
should be
php Syntax (Toggle Plain Text)
$que_id = uniqid(que);
should be
php Syntax (Toggle Plain Text)
$que_id = uniqid($que);
:: xarz ::
![]() |
Similar Threads
- how to open a file after running the program (C++)
- Generate User ID (PHP)
- Create double blind system in php (PHP)
- CPU Scheduling Algorithm (Java)
- Sorting in Python (Python)
- problem in generating non repeated random numbers (C)
Other Threads in the PHP Forum
- Previous Thread: PHP Gaming basics
- Next Thread: Dynamic Title Generation using PHP and MySql
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dropdown dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





