473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Warning: Invalid argument supplied for foreach()

2
Hi All,

May i know how to rectify the following php error? Thanks folks

Warning: Invalid argument supplied for foreach() in /home/alan/do_add-user.php on line 36

do_add-user.php.php on line 304:
$project_array = $_POST[Project];


304 foreach($project_array as $project){
$sql3 = "INSERT INTO Mapping SET user_id='$uid', project_id='$project'";
$result3 = @mysql_query($sql3,$connection) or die(mysql_error());

}
Feb 12 '08 #1
1 1323
rpnew
188 100+
Hi All,

May i know how to rectify the following php error? Thanks folks

Warning: Invalid argument supplied for foreach() in /home/alan/do_add-user.php on line 36

do_add-user.php.php on line 304:
$project_array = $_POST[Project];

304 foreach($project_array as $project){
$sql3 = "INSERT INTO Mapping SET user_id='$uid', project_id='$project'";
$result3 = @mysql_query($sql3,$connection) or die(mysql_error());

}
Hi,
Here you are trying to use normal variable in foreach loop.... instead of that try this......(if your 'Project' variable is an array...)
[PHP]
foreach($_POST['Project'] as $project){
$sql3 = "INSERT INTO Mapping SET user_id='$uid', project_id='$project'";
$result3 = @mysql_query($sql3,$connection) or die(mysql_error());

}
[/PHP]
Regards,
RP
Feb 12 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

35
by: jerrygarciuh | last post by:
Hi all, I was just wondering what popular opinion is on PHP giving this warning: Warning: Invalid argument supplied for foreach() in /home/boogerpic/public_html/my.php on line 6 when...
4
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the...
2
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is...
1
by: lsmamadele | last post by:
I am getting the following error messages in my search: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
2
by: yogitha | last post by:
For the below code i am getting an error like : --------------------------------------------------------------- Warning: fread(): supplied argument is not a valid stream resource in...
1
by: custom3 | last post by:
Hello, I keep getting the following warning: "PHP Warning: Invalid argument supplied for foreach() in /home/csiexecu/public_html/modules/mod_mainmenu.php on line 339" I am a novice Joomla...
1
by: BryanA | last post by:
Something seems to be wrong with this function and I can't figure out why it is failing. The error that it gives is; Invalid argument supplied for foreach() . function transposition($words){...
14
by: rashgang | last post by:
i have dynamically created checkbox which will like yahoo mail if check box selected it will highlight a row but deleteall function is not working plz chek it function doDeleteAll($objArray){ ...
21
by: rashgang | last post by:
no check box selected when i gave delete all link the error is coming <?php include "includes/connection.php"; include "includes/Functions_category.php"; include...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.