[CODE=php]<?php
session_start() ;
require_once('d b.php');
include('functi ons.php');
$user = get_username ( $_SESSION['user_id'] );
//if ( $_SESSION['logged_in'] ):
checkLogin ( '1 2' );
?>
<html>
<title>Manage Articles </title>
<head><link href="css/styles.css" rel="stylesheet " type="text/css" /></head>
<body>
<?php
if($_REQUEST['action']=="edit")
{
mysql_query("UP DATE articles SET status = '0' WHERE id={$_REQUEST['id']};");
}
if($_REQUEST['action']=="read")
{
$s = mysql_query("SE LECT * FROM articles where id={$_REQUEST['id']};");
$a = 0;
while( $article = mysql_fetch_arr ay($s) )
{
echo "<b> Article Details </b></br></br></br>";
echo "<i>Title </i>:: ".$ article['title']."</br></br>";
echo "<i>Keyword </i> :: ".$ article['keyword']." </br></br>";
echo "<i>Body</i> :: ".$ article['body']." </br></br>";
echo "<i>Submitt ed By</i> :: ".$ article['user']." </br></br>";
echo "<i>Submitt ed On</i> :: ".$ article['date']." </br></br></br>";
echo "<hr>";
$a++;
}
}
if($_REQUEST['action']=="del")
{
mysql_query("DE LETE FROM articles WHERE id={$_REQUEST['id']};");
}
if($_REQUEST['action']=="activate")
{
mysql_query("UP DATE articles SET status = '1' WHERE id={$_REQUEST['id']};");
}
$result=mysql_q uery("SELECT * FROM articles where status = 0 and user = \"$user\" order by id;");
$i=0;
echo "<table border = 1 class = border1>";
echo "<tr><a><b>Inac tive Articles</b></a></tr>";
echo "<td>Title</td>";
echo "<td>Submit ted By</td>";
echo "<td>Date</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td></tr>";
while( $row = mysql_fetch_arr ay($result) )
{
echo "<td>".$row['title']."</td>";
//echo "<td >".$row['keyword']." </td>";
//echo "<td >".$row['body']." </td>";
echo "<td >".$row['user']." </td>";
echo "<td >".$row['date']." </td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=del&id=".$row['id']."><span class=red>Delet e</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=activate&id=" .$row['id']."><span class=red>Edit</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=read&id=".$ro w['id']."><span class=red>Read</span></a></td></tr>";
//echo "<td class=tabval></td>";
//echo "</tr>";
$i++;
}
echo "</table>";
?>
<?php
$result=mysql_q uery("SELECT * FROM articles where status = 1 and user = \"$user\" order by id;");
$i=0;
echo "</br></br></br>";
echo "<hr>";
echo "<table border = 1>";
echo "</br>";
echo "<tr><a ><b>Active Articles</b></a></tr>";
echo "<td>Title</td>";
echo "<td>Submit ted By</td>";
echo "<td>Date</td>";
echo "<td></td>";
echo "<td></td>";
echo "</tr>";
while( $row = mysql_fetch_arr ay($result) )
{
echo "<td>".$row['title']."</td>";
//echo "<td >".$row['keyword']." </td>";
//echo "<td >".$row['body']." </td>";
echo "<td >".$row['user']." </td>";
echo "<td >".$row['date']." </td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=del&id=".$row['id']."><span class=red>Delet e</span></a></td>";
//echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icle.php?action =suspend&id=".$ row['id']."><span class=red>Suspe nd</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=read&id=".$ro w['id']."><span class=red>Read</span></a></td></tr>";
//echo "<td class=tabval></td>";
//echo "</tr>";
$i++;
}
?>
</table>
</body>
</html>[/CODE]
This page works correctly as i need with the mysql_fetch_arr ay() function but with the same code as i'll show below, it gives me an error like mysql_fetch_arr ay() is not a valid mysql result source .
Why is it ?
[CODE=php]<table>
<?php if($_REQUEST['action']=="view")
{//{$_REQUEST['id']};
$s = mysql_query("se lect * from cards where card={$_REQUEST['card']}");
$a = 0;
while( $article = mysql_fetch_arr ay($s) )
{
//$sql10=mysql_qu ery("select * from cards where card={$_REQUEST['card']};")or die("<h5 align=center>Co uld Not Find the Table named cards</h5>") ;
// while($rs10=mys ql_fetch_array( $sql10))
// {
echo"<tr><embed src='./_cards/".$article['card']."' border=0 width=500 height=400 type='applicati on/x-shockwave-flash'></embed></tr>";
$a++;
}
}
?> <?php if($_REQUEST['action']=="show")
{print"<a class='titlegre en'>Birthday Cards </a></br></br>";
print"<tr>";
$sql=mysql_quer y("select * from cards where type = 'Birthday' ") or die("<h5 align=center>Co uld Not Find the Table named cards</h5>");
while($rs=mysql _fetch_array($s ql))
{
print"<td>";
print"<table>";
print"<tr><a href= index.php?actio n=view&card=".$ rs['card']."><img src='./_cards/".$rs["thumbnail"]."' width=60 height=50 border=0></a></tr>";
echo "<tr class='bodyblue ' align='center'> <div align='center'> ";
echo $rs['name'];
echo"</div>";
print"</tr>";
print"</table>";
print"</td>";
}
print"</tr>";
}[/CODE]
Plese help i keep gettin this kinda prblms
session_start() ;
require_once('d b.php');
include('functi ons.php');
$user = get_username ( $_SESSION['user_id'] );
//if ( $_SESSION['logged_in'] ):
checkLogin ( '1 2' );
?>
<html>
<title>Manage Articles </title>
<head><link href="css/styles.css" rel="stylesheet " type="text/css" /></head>
<body>
<?php
if($_REQUEST['action']=="edit")
{
mysql_query("UP DATE articles SET status = '0' WHERE id={$_REQUEST['id']};");
}
if($_REQUEST['action']=="read")
{
$s = mysql_query("SE LECT * FROM articles where id={$_REQUEST['id']};");
$a = 0;
while( $article = mysql_fetch_arr ay($s) )
{
echo "<b> Article Details </b></br></br></br>";
echo "<i>Title </i>:: ".$ article['title']."</br></br>";
echo "<i>Keyword </i> :: ".$ article['keyword']." </br></br>";
echo "<i>Body</i> :: ".$ article['body']." </br></br>";
echo "<i>Submitt ed By</i> :: ".$ article['user']." </br></br>";
echo "<i>Submitt ed On</i> :: ".$ article['date']." </br></br></br>";
echo "<hr>";
$a++;
}
}
if($_REQUEST['action']=="del")
{
mysql_query("DE LETE FROM articles WHERE id={$_REQUEST['id']};");
}
if($_REQUEST['action']=="activate")
{
mysql_query("UP DATE articles SET status = '1' WHERE id={$_REQUEST['id']};");
}
$result=mysql_q uery("SELECT * FROM articles where status = 0 and user = \"$user\" order by id;");
$i=0;
echo "<table border = 1 class = border1>";
echo "<tr><a><b>Inac tive Articles</b></a></tr>";
echo "<td>Title</td>";
echo "<td>Submit ted By</td>";
echo "<td>Date</td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td></tr>";
while( $row = mysql_fetch_arr ay($result) )
{
echo "<td>".$row['title']."</td>";
//echo "<td >".$row['keyword']." </td>";
//echo "<td >".$row['body']." </td>";
echo "<td >".$row['user']." </td>";
echo "<td >".$row['date']." </td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=del&id=".$row['id']."><span class=red>Delet e</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=activate&id=" .$row['id']."><span class=red>Edit</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=read&id=".$ro w['id']."><span class=red>Read</span></a></td></tr>";
//echo "<td class=tabval></td>";
//echo "</tr>";
$i++;
}
echo "</table>";
?>
<?php
$result=mysql_q uery("SELECT * FROM articles where status = 1 and user = \"$user\" order by id;");
$i=0;
echo "</br></br></br>";
echo "<hr>";
echo "<table border = 1>";
echo "</br>";
echo "<tr><a ><b>Active Articles</b></a></tr>";
echo "<td>Title</td>";
echo "<td>Submit ted By</td>";
echo "<td>Date</td>";
echo "<td></td>";
echo "<td></td>";
echo "</tr>";
while( $row = mysql_fetch_arr ay($result) )
{
echo "<td>".$row['title']."</td>";
//echo "<td >".$row['keyword']." </td>";
//echo "<td >".$row['body']." </td>";
echo "<td >".$row['user']." </td>";
echo "<td >".$row['date']." </td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=del&id=".$row['id']."><span class=red>Delet e</span></a></td>";
//echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icle.php?action =suspend&id=".$ row['id']."><span class=red>Suspe nd</span></a></td>";
echo "<td><a onclick=\"retur n confirm('Are you sure ?');\" href=manage_art icles.php?actio n=read&id=".$ro w['id']."><span class=red>Read</span></a></td></tr>";
//echo "<td class=tabval></td>";
//echo "</tr>";
$i++;
}
?>
</table>
</body>
</html>[/CODE]
This page works correctly as i need with the mysql_fetch_arr ay() function but with the same code as i'll show below, it gives me an error like mysql_fetch_arr ay() is not a valid mysql result source .
Why is it ?
[CODE=php]<table>
<?php if($_REQUEST['action']=="view")
{//{$_REQUEST['id']};
$s = mysql_query("se lect * from cards where card={$_REQUEST['card']}");
$a = 0;
while( $article = mysql_fetch_arr ay($s) )
{
//$sql10=mysql_qu ery("select * from cards where card={$_REQUEST['card']};")or die("<h5 align=center>Co uld Not Find the Table named cards</h5>") ;
// while($rs10=mys ql_fetch_array( $sql10))
// {
echo"<tr><embed src='./_cards/".$article['card']."' border=0 width=500 height=400 type='applicati on/x-shockwave-flash'></embed></tr>";
$a++;
}
}
?> <?php if($_REQUEST['action']=="show")
{print"<a class='titlegre en'>Birthday Cards </a></br></br>";
print"<tr>";
$sql=mysql_quer y("select * from cards where type = 'Birthday' ") or die("<h5 align=center>Co uld Not Find the Table named cards</h5>");
while($rs=mysql _fetch_array($s ql))
{
print"<td>";
print"<table>";
print"<tr><a href= index.php?actio n=view&card=".$ rs['card']."><img src='./_cards/".$rs["thumbnail"]."' width=60 height=50 border=0></a></tr>";
echo "<tr class='bodyblue ' align='center'> <div align='center'> ";
echo $rs['name'];
echo"</div>";
print"</tr>";
print"</table>";
print"</td>";
}
print"</tr>";
}[/CODE]
Plese help i keep gettin this kinda prblms
Comment