php


I am not able to insert the content of table 1 into table 2 in sql using Php?


$conn = mysqli_connect($dbhost,$dbuser,$dbpass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
for($i=0;$i<=feof($getdata);$i++)
{
if (filter_var($data[$i][1], FILTER_VALIDATE_EMAIL)){
echo $data[$i][1];
$email=$data[$i][1];
$name=$data[$i][0];
$sql ="INSERT INTO promo_user (name,email) VALUES ('$name','$email')";
mysqli_query($conn,$sql);
$sql .="INSERT INTO promo_type (uid) select uid from promo_user";
mysqli_query($conn,$sql);
mysqli_close($conn);
}
this is my code here i am first inserting some content (name and email) into table promo_user and then trying to insert the uid from promo_user to table promo_type but this is not working the content is going to table promo_user but not to promo_type
please help
After inserting get the insert id
$sql ="INSERT INTO promo_user (name,email) VALUES ('$name','$email')";
mysqli_query($conn,$sql);
$uid = mysqli_insert_id($conn);
$sql ="INSERT INTO promo_type set uid =$uid";
mysqli_query($conn,$sql);
mysqli_close($conn);

Related Links

Xampp apache won't run after previous Apache installation
Session variable giving error. worked before
php Include function not working wamp
Converting Plain texts to Links in php
Need to Know Which Query going to Execute in code igniter
Running a function in DLL(.net) in PHP - Nothing seems to work
You have an error in your SQL syntax; check the manual…Line 6
Join two regex or do the same inside the same regex
Facebook PHP SDK getSession return NULL
HybridAuth (any Version) Install Issue
How to filer PHP Array stdClass Object
How to set cron job but only using ftp details i dont have cpanel
Fetching nid in drupal
How to get a URL query string which has “?” inside?
Get google analytics active goals data
Fetch values from multi dimensional array

Categories

HOME
android-espresso
adfs3.0
theano
amp
openfoam
mithril.js
angular2-template
sharepoint-online
gtk
swarm
clickable-image
parsley.js
mailmerge
live-streaming
amazon-elb
texas-instruments
supervisord
temperature
closures
exec-maven-plugin
pfobject
qa
amazon-sns
exchange-server-2010
sipp
managed-c++
plyr
clipboard
region
audit
winsock
progid
commonsware-cwac
delayed-job
seafile-server
cmis
netstat
love2d
text-decorations
praat
swfupload
netapp
flipkart
fluid-mac-app-engine
morphline
reverse-dns
aws-kinesis-firehose
django-static-precompiler
icecast
sigsegv
gnome-terminal
sesame
ltrace
yargs
cefpython
bigdecimal
wininet
coovachilli
cdo.message
fiber
accessibilityservice
perceptron
msgpack
ruby-on-rails-4.1
chicagoboss
dsa
canopy
hmisc
compositetype
dynamics-ax-2012-r2
com0com
flow-js
pass-by-value
sunos
rebar
inputbox
tabris
windows-messages
jini
redpitaya
meteor-collections
preorder
tabletools
infinite
apache-shindig
mousemotionlistener
insertonsubmit
quickgraph
unicoins
rikulo
jquery-cycle
sfinae
coordinate
opends
kolite
winsxs
startupscript
directshow.net
3des
mongrel
jdownloader
ninject-interception
explicit
principles
data-retrieval

Resources

Encrypt Message