Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   work with local but it's not with on line server (http://www.go4expert.com/forums/local-line-server-t23839/)

abosirage 11Nov2010 12:51

work with local but it's not with on line server
 
1 Attachment(s)
:confused: 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

shabbir 11Nov2010 12:54

Re: work with local but it's not with on line server
 
What error does it give when run online.

abosirage 11Nov2010 14:50

Re: work with local but it's not with on line server
 
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

shabbir 11Nov2010 17:53

Re: work with local but it's not with on line server
 
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

abosirage 11Nov2010 18:37

Re: work with local but it's not with on line server
 
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);

shabbir 11Nov2010 19:19

Re: work with local but it's not with on line server
 
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.

abosirage 14Nov2010 11:34

Re: work with local but it's not with on line server
 
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>


shabbir 14Nov2010 17:27

Re: work with local but it's not with on line server
 
What does $id contain in SELECT * FROM personnel WHERE id=$id

abosirage 14Nov2010 18:06

Re: work with local but it's not with on line server
 
dear Shabbir

thank you for your reply
good day

in my code $id contain (int) id for personnel record

abosirage 14Nov2010 18:22

Re: work with local but it's not with on line server
 
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


All times are GMT +5.5. The time now is 10:12.