•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,474 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,251 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 53763 | Replies: 10
![]() |
•
•
Join Date: Jul 2004
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
when im test in my local machine i dont have any error but when im trying to test in web i have this error, the same DB, the same tables, the same data in both structures any idea????
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site244/fst/var/www/html/categoria.php on line 107
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site244/fst/var/www/html/categoria.php on line 107
<?php
require('conexion2.php');
$SQLEmpresa= "SELECT empresa.cve_Empresa, Nombre, Direccion, pagina, telefono
FROM empresa, empresa_Categoria
WHERE ".$_GET['cve_Categoria']." = empresa_Categoria.cve_Categoria
AND empresa_Categoria.cve_Empresa = empresa.cve_Empresa";
$rsEmpresa = mysql_query($SQLEmpresa,$conexion);
$reg = array();
-->line 107 while ($reg = mysql_fetch_array($rsEmpresa))
{
$nombre = $reg["Nombre"];
$direccion = $reg["Direccion"];
$telefono = $reg["telefono"];
$pagina = $reg["pagina"];
$cve_Empresa = $reg["cve_Empresa"];
?>
•
•
Join Date: Jul 2004
Posts: 215
Reputation:
Rep Power: 5
Solved Threads: 4
Your local machine does not show because you have turned off the error reporting. Anyway try the below code. Do let me know whether it works.
[PHP]<?php
require('conexion2.php');
$SQLEmpresa= "SELECT empresa.cve_Empresa, Nombre, Direccion, pagina, telefono
FROM empresa, empresa_Categoria
WHERE ".$_GET['cve_Categoria']." = empresa_Categoria.cve_Categoria
AND empresa_Categoria.cve_Empresa = empresa.cve_Empresa";
$rsEmpresa = mysql_query($SQLEmpresa,$conexion);
while ($reg = mysql_fetch_array($rsEmpresa))//line 107
{
$nombre = $reg["Nombre"];
$direccion = $reg["Direccion"];
$telefono = $reg["telefono"];
$pagina = $reg["pagina"];
$cve_Empresa = $reg["cve_Empresa"]
} // You forget to close while loop
?>[/PHP]
[PHP]<?php
require('conexion2.php');
$SQLEmpresa= "SELECT empresa.cve_Empresa, Nombre, Direccion, pagina, telefono
FROM empresa, empresa_Categoria
WHERE ".$_GET['cve_Categoria']." = empresa_Categoria.cve_Categoria
AND empresa_Categoria.cve_Empresa = empresa.cve_Empresa";
$rsEmpresa = mysql_query($SQLEmpresa,$conexion);
while ($reg = mysql_fetch_array($rsEmpresa))//line 107
{
$nombre = $reg["Nombre"];
$direccion = $reg["Direccion"];
$telefono = $reg["telefono"];
$pagina = $reg["pagina"];
$cve_Empresa = $reg["cve_Empresa"]
} // You forget to close while loop
?>[/PHP]
•
•
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation:
Rep Power: 6
Solved Threads: 5
Yep, character case is extremely important both in MySQL and in PHP - I suggest most of the time to keep things in lowercase
•
•
Join Date: Jun 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource...this is the same bug i am fed of it...please do some help...I am trying to retrieve record from the database from sa_settings table but to retrieve the information related to product, i have to go to the table cards to look up for ProductID in it....i got one record from the database but why the hell that While loop search for another record when I dont have any other record in the table...this is sucking my mind and i am trying to get over it for the last two days...hope u guyz could help me out of it..
<DIV id="<?PHP echo ($_GET['ID']); ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="top">
<td height="16" colspan="3" bgcolor="#FFFFFF"><strong><font color="#000066" size="1" face="Tahoma" style="bold"><?PHP echo ($_GET['ID']); ?></font></strong></td>
</tr>
<tr align="center" valign="top">
<td height="16" colspan="3" bgcolor="#FFFFFF"> </td>
</tr>
<?php
$User_name=$_GET['ID'];
$sql="select * from sa_settings where username='$User_name'";
$result = mysql_query ($sql) or die("Query error: ". mysql_error());
$counter=0;
mysql_num_rows($result);
if(mysql_num_rows($result)>0)
{
while($rs=mysql_fetch_array($result))
{
$counter=$counter+1;
$PID=$rs['ProductID'];
$COMM=$rs['Commision'];
$sql="select * from cards WHERE CardID=$PID";
$result=mysql_query($sql);
?>
<tr valign="top">
<td height="16" bgcolor="#FFFFFF"><?php echo $result['CardName']; ?> </td>
<td width="134" height="16" bgcolor="#FFFFFF"><?php echo $result['Price']; ?></td>
<td width="151" bgcolor="#FFFFFF"><input name="Commision<?php echo $counter; ?>" type="text" id="Commision<?php echo $counter; ?>" value="<?php echo $COMM; ?>" size="7"></td>
</tr>
<?php
}
}
?>
the schema for the two tables are as follows;
cards table
-------------
CardID
CardName
Price
Status
sa_settings table
-------------------
usID
username
ProductID --> CardID
Commision
I want to retrieve CardName from cards table, I get one such result but there is no second result and While loop is again entering in to its body to look up for the record...why??????
I have tested the queries on mySQL engine and they are giving me only one result per record. What is wrong with the code...
<DIV id="<?PHP echo ($_GET['ID']); ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="top">
<td height="16" colspan="3" bgcolor="#FFFFFF"><strong><font color="#000066" size="1" face="Tahoma" style="bold"><?PHP echo ($_GET['ID']); ?></font></strong></td>
</tr>
<tr align="center" valign="top">
<td height="16" colspan="3" bgcolor="#FFFFFF"> </td>
</tr>
<?php
$User_name=$_GET['ID'];
$sql="select * from sa_settings where username='$User_name'";
$result = mysql_query ($sql) or die("Query error: ". mysql_error());
$counter=0;
mysql_num_rows($result);
if(mysql_num_rows($result)>0)
{
while($rs=mysql_fetch_array($result))
{
$counter=$counter+1;
$PID=$rs['ProductID'];
$COMM=$rs['Commision'];
$sql="select * from cards WHERE CardID=$PID";
$result=mysql_query($sql);
?>
<tr valign="top">
<td height="16" bgcolor="#FFFFFF"><?php echo $result['CardName']; ?> </td>
<td width="134" height="16" bgcolor="#FFFFFF"><?php echo $result['Price']; ?></td>
<td width="151" bgcolor="#FFFFFF"><input name="Commision<?php echo $counter; ?>" type="text" id="Commision<?php echo $counter; ?>" value="<?php echo $COMM; ?>" size="7"></td>
</tr>
<?php
}
}
?>
the schema for the two tables are as follows;
cards table
-------------
CardID
CardName
Price
Status
sa_settings table
-------------------
usID
username
ProductID --> CardID
Commision
I want to retrieve CardName from cards table, I get one such result but there is no second result and While loop is again entering in to its body to look up for the record...why??????
I have tested the queries on mySQL engine and they are giving me only one result per record. What is wrong with the code...
•
•
Join Date: Jun 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
This is the snapshot of my output that I am getting with the following error string...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data/12/1/9/102/1172754/user/1246647/htdocs/MasterAgent/viewsuperagent.php on line 240
and I have this on line 240
while($rs=mysql_fetch_array($result))
Owais
Owais
Why this second text box is comming....
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data/12/1/9/102/1172754/user/1246647/htdocs/MasterAgent/viewsuperagent.php on line 240
and I have this on line 240
while($rs=mysql_fetch_array($result))
Owais
Owais
Why this second text box is comming....
•
•
Join Date: Mar 2006
Location: Florence Ky
Posts: 31
Reputation:
Rep Power: 3
Solved Threads: 3
check your query. If you get the not supplied valid arguement, 99.9% of the time. the problem is in your query. Echo out your query and check it to make sure that is working properly. This can be done any place that you can free-form a MySQL query in your database. Check to make sure it is workign properly.
http://img.photobucket.com/albums/v6.../dgstudios.jpg
When all that is becomes one. That is the anomoly. That is... Death's Gate Studios (c) 2005
When all that is becomes one. That is the anomoly. That is... Death's Gate Studios (c) 2005
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Having the same issue, using a previous page as a template which does connect, so I would think there are no issues there. When i cut and paste the sql statement into phpmyadmin it works fine. It is a rather lengthy sql statement and complicated using temorary tables.
$statistics = mysql_query("CREATE TEMPORARY TABLE set1 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set1
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '1'
GROUP BY users.id;
CREATE TEMPORARY TABLE set2 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set2
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '2'
GROUP BY users.id;
CREATE TEMPORARY TABLE set3 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set3
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '3'
GROUP BY users.id;
CREATE TEMPORARY TABLE set4 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set4
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '4'
GROUP BY users.id;
CREATE TEMPORARY TABLE set5 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set5
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '5'
GROUP BY users.id;
CREATE TEMPORARY TABLE set6 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set6
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '6'
GROUP BY users.id;
CREATE TEMPORARY TABLE set7 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set7
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '7'
GROUP BY users.id;
SELECT D.last, D.first,
D.dept, D.duties, D.doh,
set1.setid, set1.score, set1.totalscore, set1.time,
set2.setid, set2.score, set2.totalscore, set2.time,
set3.setid, set3.score, set3.totalscore, set3.time,
set4.setid, set4.score, set4.totalscore, set4.time,
set5.setid, set5.score, set5.totalscore, set5.time,
set6.setid, set6.score, set6.totalscore, set6.time,
set7.setid, set7.score, set7.totalscore, set7.time
FROM directory2 AS D
LEFT JOIN users AS U ON D.last = U.last_name
LEFT JOIN set1 USING (id)
LEFT JOIN set2 USING (id)
LEFT JOIN set3 USING (id)
LEFT JOIN set4 USING (id)
LEFT JOIN set5 USING (id)
LEFT JOIN set6 USING (id)
LEFT JOIN set7 USING (id)
WHERE D.dept = '01 - Atlanta'
GROUP BY last
".$limiting);
while($astatistics = mysql_fetch_array($statistics)){
AND IT DIES RIGHT HERE. HAVE TRIED THIS A FEW DIFFERENT WAYS AND IT WILL NOT EXECUTE THE QUERY - ANY IDEAS?
Actually this is a a series of sql statments separated by semicolons, it works in phpmyadmin , should they be separate sql statements?
$statistics = mysql_query("CREATE TEMPORARY TABLE set1 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set1
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '1'
GROUP BY users.id;
CREATE TEMPORARY TABLE set2 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set2
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '2'
GROUP BY users.id;
CREATE TEMPORARY TABLE set3 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set3
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '3'
GROUP BY users.id;
CREATE TEMPORARY TABLE set4 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set4
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '4'
GROUP BY users.id;
CREATE TEMPORARY TABLE set5 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set5
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '5'
GROUP BY users.id;
CREATE TEMPORARY TABLE set6 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set6
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '6'
GROUP BY users.id;
CREATE TEMPORARY TABLE set7 (
id VARCHAR(5) NOT NULL
, score VARCHAR(5) NOT NULL DEFAULT 0
, totalscore VARCHAR(5) NOT NULL NOT NULL DEFAULT 0
, time timestamp NOT NULL
, setid VARCHAR(5) NOT NULL
) ;
INSERT INTO set7
(id, score, totalscore, time, setid)
SELECT
users.id, statistics.score, statistics.totalscore, MAX(statistics.time), sets.id
FROM users, statistics, sets
WHERE users.id = statistics.userid
AND statistics.setid = sets.id
AND sets.id = '7'
GROUP BY users.id;
SELECT D.last, D.first,
D.dept, D.duties, D.doh,
set1.setid, set1.score, set1.totalscore, set1.time,
set2.setid, set2.score, set2.totalscore, set2.time,
set3.setid, set3.score, set3.totalscore, set3.time,
set4.setid, set4.score, set4.totalscore, set4.time,
set5.setid, set5.score, set5.totalscore, set5.time,
set6.setid, set6.score, set6.totalscore, set6.time,
set7.setid, set7.score, set7.totalscore, set7.time
FROM directory2 AS D
LEFT JOIN users AS U ON D.last = U.last_name
LEFT JOIN set1 USING (id)
LEFT JOIN set2 USING (id)
LEFT JOIN set3 USING (id)
LEFT JOIN set4 USING (id)
LEFT JOIN set5 USING (id)
LEFT JOIN set6 USING (id)
LEFT JOIN set7 USING (id)
WHERE D.dept = '01 - Atlanta'
GROUP BY last
".$limiting);
while($astatistics = mysql_fetch_array($statistics)){
AND IT DIES RIGHT HERE. HAVE TRIED THIS A FEW DIFFERENT WAYS AND IT WILL NOT EXECUTE THE QUERY - ANY IDEAS?
Actually this is a a series of sql statments separated by semicolons, it works in phpmyadmin , should they be separate sql statements?
Last edited by dkoch0452 : Jun 14th, 2007 at 2:47 pm.
I am also getting this error ? Any help would greatly be appreciated.
Thanks MrTerry
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluestar/public_html/forum/admin/admin_ideas.php on line 94
Thanks MrTerry
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bluestar/public_html/forum/admin/admin_ideas.php on line 94
<?php
/***************************************************************************
* admin_ideas.php
* -------------------
* begin : Saturday, Jul 28, 2007
* copyright : (C) 2007 Funender.com
* email : admin@funender.com
*
* $Id:lang_admin_ideas.php,v 1.0.1 2007/07/28 23:24:01 FuNEnD3R Exp $
*
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = append_sid("admin_ideas.$phpEx").'&mode=view';
$module['General']['Admin_Ideas'] = $file;
return;
}
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
require($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin_ideas.' . $phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
$status = array("0" => $lang['pending'],
"1" => $lang['testing'],
"2" => "<font color=\"green\">".$lang['done']."</font>",
"3" => "<font color=\"red\">".$lang['denied']."</font>");
if($_GET["mode"] == "view" || $_POST["mode"] == "view") {
$template->set_filenames(array(
"body" => "admin/admin_ideas.tpl")
);
$template->assign_vars(array(
"ADD_NEW_IDEA" => $lang['Add_New_Idea'],
"SAVE" => $lang['Save'],
"TESTING" => $lang['Testing'],
"COMPLETE" => $lang['Complete'],
"DENY" => $lang['Deny'],
"FILTER" => $lang['Filter'],
"EDIT" => $lang['Edit'],
"DELETE" => $lang['Delete'],
"CURRENTLY" => $lang['Currently_Working'],
"ADDED" => $lang['New_Idea_Added'],
"WISH" => $lang['Do_Not_Wish'],
"F_NONE" => $lang['Filter_none'],
"F_PENDING" => $lang['Filter_pending'],
"F_TESTING" => $lang['Filter_testing'],
"F_DONE" => $lang['Filter_done'],
"F_DENIED" => $lang['Filter_denied'],
"S_DATE" => $lang['Status_Date'],
"S_USER" => $lang['Status_User'],
"S_IDEA" => $lang['Status_Idea'],
"S_STATUS" => $lang['Status_Status'],
"S_OPTIONS" => $lang['Status_Options'],
"B_WRITE" => $lang['Admin_Written'],
"B_SUBMIT" => $lang['Add_Submit'],
"U_IDEA_ACTION" => append_sid("admin_ideas.$phpEx"),
"U_IDEA_ALL" => append_sid("?mode=view"),
"U_IDEA_ORD1" => append_sid("?mode=view&orderby=0"),
"U_IDEA_ORD2" => append_sid("?mode=view&orderby=1"),
"U_IDEA_ORD3" => append_sid("?mode=view&orderby=2"),
"U_IDEA_ORD4" => append_sid("?mode=view&orderby=3"))
);
$orderby = $_GET[orderby];
if($orderby != '')
{
$res = mysql_query("SELECT * FROM phpbb_newideas WHERE idea_status='$orderby' ORDER BY idea_id DESC");
}
else
{
$res = mysql_query("SELECT * FROM phpbb_newideas ORDER BY idea_status ASC, idea_id DESC");
}
while($row = mysql_fetch_array($res)) {
$resb = mysql_query("SELECT username FROM phpbb_users WHERE user_id = '".$row["user_id"]."'");
$rowb = mysql_fetch_array($resb);
if($row["idea_status"] == 1) {
$opt1 = append_sid("?mode=status&idea_id=".$row["idea_id"]."&status=0");
} else {
$opt1 = append_sid("?mode=status&idea_id=".$row["idea_id"]."&status=1");
}
$vars = array("IDEA_TIME" => date("m/d/Y", $row["idea_time"]),
"IDEA_TEXT" => nl2br(htmlspecialchars($row["idea_text"], HTML_ENTITIES)),
"IDEA_STATUS" => $status[$row["idea_status"]],
"USER_NAME" => htmlspecialchars($rowb["username"], HTML_ENTITIES),
"IDEA_OPT1" => $opt1,
"IDEA_OPT2" => append_sid("?mode=status&idea_id=".$row["idea_id"]."&status=2"),
"IDEA_OPT3" => append_sid("?mode=status&idea_id=".$row["idea_id"]."&status=3"),
"IDEA_OPT4" => append_sid("?mode=edit&idea_id=".$row["idea_id"]),
"IDEA_OPT5" => append_sid("?mode=del&idea_id=".$row["idea_id"]));
$template->assign_block_vars("idearow", $vars);
}
$template->pparse("body");
}
if($_POST["save_idea"]) {
$idea_text = $_POST["idea_text"];
if(strlen($idea_text) <= 0) {
$message = $lang['Enter_Message'] . "<br /><br /><a href=\"javascript:history.go(-1)\">". sprintf($lang['Click_Here_Go_Back'] . "</a>");
message_die(GENERAL_MESSAGE, $message);
}
$sql = "INSERT INTO phpbb_newideas (idea_text, idea_time, user_id)
VALUES('".$_POST["idea_text"]."', '".time()."', '".$userdata["user_id"]."')";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert into idea table", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Idea_Saved'] . "<br /><br /><a href=\"".append_sid("admin_ideas.$phpEx?mode=view")."\">". sprintf($lang['Click_Here_Go_Back'] . "</a>");
message_die(GENERAL_MESSAGE, $message);
}
if($_GET["mode"] == "status") {
$sql = "UPDATE phpbb_newideas SET idea_status = '".$_GET["status"]."' WHERE idea_id = '".$_GET["idea_id"]."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update idea table", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Status_Updated'] . "<br /><br /><a href=\"".append_sid("admin_ideas.$phpEx?mode=view")."\">". sprintf($lang['Click_Here_Go_Back'] . "</a>");
message_die(GENERAL_MESSAGE, $message);
}
if($_GET["mode"] == "del") {
$sql = "DELETE FROM phpbb_newideas WHERE idea_id = '".$_GET["idea_id"]."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update idea table", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Idea_Deleted'] . "<br /><br /><a href=\"".append_sid("admin_ideas.$phpEx?mode=view")."\">". sprintf($lang['Click_Here_Go_Back'] . "</a>");
message_die(GENERAL_MESSAGE, $message);
}
if($_GET["mode"] == "edit") {
$sql = "SELECT idea_text, idea_id FROM phpbb_newideas WHERE idea_id = '".$_GET["idea_id"]."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update idea table", "", __LINE__, __FILE__, $sql);
}
$row = mysql_fetch_array($result);
$template->set_filenames(array(
"body" => "admin/admin_ideas_edit.tpl")
);
$template->assign_vars(array(
"EDIT_IDEA" => $lang['Edit_Idea'],
"SAVE" => $lang['Save'],
"IDEA_TEXT" => htmlspecialchars($row["idea_text"], HTML_ENTITIES),
"IDEA_ID" => $row["idea_id"],
"B_WRITE" => $lang['Admin_Written'],
"B_SUBMIT" => $lang['Add_Submit'],
"U_IDEA_ACTION" => append_sid("admin_ideas.$phpEx"))
);
$template->pparse("body");
}
if($_POST["save_edit_idea"]) {
$sql = "UPDATE phpbb_newideas SET idea_text = '".$_POST["idea_text"]."' WHERE idea_id = '".$_POST["idea_id"]."'";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update idea table", "", __LINE__, __FILE__, $sql);
}
$message = $lang['Idea_Edited'] . "<br /><br /><a href=\"".append_sid("admin_ideas.$phpEx?mode=view")."\">". sprintf($lang['Click_Here_Go_Back'] . "</a>");
message_die(GENERAL_MESSAGE, $message);
}
include('./page_footer_admin.'.$phpEx);
?> •
•
Join Date: Dec 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi
I am developing a simple login system for college project.
Facing difficulty in getting this code working.
It is showing the same error:-
"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/pakistan/public_html/checklogin.php on line 11 Login unsuccessful!Either your UserID or your Password is incorrect.
Please put the right UserID or Password, otherwise register yourself Back"
here is the code:-
<?php
session_start();
$conn = mysql_connect('localhost', 'user', 'password');
$result = mysql_query('select * from Customer where
UserID = "'. $_POST[UserID].'" And Password = "'. $_POST[Password].'"');
$row = mysql_fetch_array($result);
if ($row[UserID]==$_POST['UserID'])
{
echo 'Login successful';
echo 'Please click on';
echo "</br><a href=\"Tshirt.php\"> T-Shirt</a>";
}
else
{
echo '<blink><font color=\”red\”>Login unsuccessful!';
echo 'Either your UserID or your Password is incorrect.';
echo '</br>Please put the right UserID or Password, otherwise register yourself';
echo "</br><a href=\"Shopping.php\"> Back</a>";
}
?>
can anybody tell me where the problem is?
thanks
I am developing a simple login system for college project.
Facing difficulty in getting this code working.
It is showing the same error:-
"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/pakistan/public_html/checklogin.php on line 11 Login unsuccessful!Either your UserID or your Password is incorrect.
Please put the right UserID or Password, otherwise register yourself Back"
here is the code:-
<?php
session_start();
$conn = mysql_connect('localhost', 'user', 'password');
$result = mysql_query('select * from Customer where
UserID = "'. $_POST[UserID].'" And Password = "'. $_POST[Password].'"');
$row = mysql_fetch_array($result);
if ($row[UserID]==$_POST['UserID'])
{
echo 'Login successful';
echo 'Please click on';
echo "</br><a href=\"Tshirt.php\"> T-Shirt</a>";
}
else
{
echo '<blink><font color=\”red\”>Login unsuccessful!';
echo 'Either your UserID or your Password is incorrect.';
echo '</br>Please put the right UserID or Password, otherwise register yourself';
echo "</br><a href=\"Shopping.php\"> Back</a>";
}
?>
can anybody tell me where the problem is?
thanks
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- mysql_fetch_array(): supplied argument is not a valid MySQL (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource (PHP)
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
Other Threads in the PHP Forum
- Previous Thread: query in mysql
- Next Thread: button (Save target as)


Linear Mode