work with local but it's not with on line server

abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear friends
I have this question my following code work with local but it's not with on line server the

the pages code is attached

please have a look & tell me how to do with it
remember that code works OK on local host
Attached Files
File Type: txt my page code.txt (2.7 KB, 4 views)
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
What error does it give when run online.
0
abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear shabbir
good day

the error showing when I run it online is:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/umma/public_html/db/data/view.php on line 11
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
This means it is nothing to do with your online or offline issue but your code is not well coded to work.

What is the code you have on line 11
0
abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear Shabbir

good day

I attached text file for my pages code with my post
anyhow the code in line 11 is:
$myrow = mysql_fetch_array($result);
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Don't expect that someone will download your txt file. Split code into each files. Upload. test and tell you what could be the changes needed. Will you do the same for someone's query?

Coming back to your issue.

You are having this query.

$result = mysql_query("SELECT * FROM personnel WHERE id=$id");
$myrow = mysql_fetch_array($result);
So I can sense that your query and id variables does not have the right values to return the right result set.
0
abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear Shabbir

my view.php code like this:
Code:
<head>
<meta http-equiv="Content-Language" content="en-us">
</head>
<div align="center" dir="rtl">
<table border="0" width="65%" id="table1">
<tr><td><?php 
include ('config.php');
mysql_select_db("umma_mydb"); 
$result = mysql_query("SELECT * FROM personnel WHERE id=$id"); 
$myrow = mysql_fetch_array($result);
echo "الاسم : ".$myrow["firstname"]; 
echo "<br>اللقب : ".$myrow["lastname"]; 
echo "<br>العنوان : ".$myrow["nick"]; 
echo "<br>البريد الالكتروني : ".$myrow["email"]; 
echo "<br>المرتب : ".$myrow["salary"]; 
?></td></tr></table>
<b><span lang="ar-sa"><a href="serch.php">بحــــث</a>&nbsp;&nbsp; <a href="viewdb.php">عودة للقائمة</a></span></b></p>
</div>
</HTML>
 and the page with $id value viewdb.php code :
<HTML> 
<div align="center">
	<table border="0" width="63%" id="table1">
		<tr>
			<td>
			<?php 
include ('config.php');
$result = mysql_query("SELECT * FROM personnel"); 
echo "<TABLE BORDER=2>"; 
echo"<TR><td align=center width=190><B>الاجـــــــراء</B><td align=center width=190><B>الاسم بالكامـــــل</B>
<td align=center width=220><B>العنــــــــوان</B></TR>"; 
while($myrow = mysql_fetch_array($result)) 
{ 
echo "<TR>
<td align=center width=190><a href=\"view.php?id=".$myrow['id']."\">عرض</a> ";
echo "<a href=\"delete.php?id=".$myrow['id']."\">حذف</a> ";
echo "<a href=\"edit.php?id=".$myrow['id']."\">تعديل</ a>";
echo "<td align=center width=190>".$myrow["firstname"]." ".$myrow["lastname"]."
</a><td align=center width=190>".$myrow["nick"];
} 
echo "</TABLE>"; 
?> 

			
			
			
			</td>
		</tr>
	</table>
</div>
<p align="center"><b><font size="4"><a href="serch.php">بحـــث</a>&nbsp;&nbsp;
<a href="input.php">إدخال جديد</a></font></b></p>
<p>&nbsp;</p>


</HTML>

Last edited by shabbir; 14Nov2010 at 17:27.. Reason: Code blocks
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
What does $id contain in SELECT * FROM personnel WHERE id=$id
0
abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear Shabbir

thank you for your reply
good day

in my code $id contain (int) id for personnel record
0
abosirage's Avatar, Join Date: Jul 2010
Go4Expert Member
dear Shabbir

good day

I would like to thank you very much for your time & help I inform you that my problem solved the missing was to identified $id the following line is missing in my code

$id=(int)$_GET['id'];

thank you very much