Need Some Help with PHP

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
ok here is the cod e cany any one find a problem with it and tell me my it doent work

PHP:
<?php
if (!isset($_POST['tut']) && $_GET['sel'] != "") {
$query = "SELECT * FROM tutorial WHERE id = '$sel'";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
$news = TRUE;
echo "$r[name]<br />
$r[type]";
$tutr = wordwrap($r[disc]);
$tutr = bbcode(nl2br("$tutr"));
echo ''.$tutr.'';

            if ($profile[username] != "") {
echo '<a href="admin_tutorial.php?act=edit&uid='.$r[id].'">Edit</a> <a href="admin_tutorial.php?act=remove&uid='.$r[id].'">Delete</a><br />';
} else { echo '<br />'; }
}
if (!$news) {
echo "Error<br>";
echo 'All The tutorial Items Were Removed';
if ($profile[username] != "") {
echo ' | <a href="admin_tutorial.php?act=post">Add tutorial</a>';
}
}
}
?>

and to view the content i do ?sel=9 but it doesnt work
 

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
admin can close this i figured out the problem with help from Chris S
 

TheJeffsta

New Member
Messages
984
Reaction score
0
Points
0
It might be useful incase some other member/s has/have the same problem, to post what you did you correct it and/or post the corrected code.

Just an opinion, but seems quite logical and helpful for others :) - but since its just me saying it, then you dont have to :p
 

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
to fix i set the varible $sel
PHP:
 <?php
if (!isset($_POST['tut']) && $_GET['sel'] != "") {
$sel = $_GET['sel'];
$query = "SELECT * FROM tutorial WHERE id = '$sel'";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
$news = TRUE;
echo "$r[name]<br />
$r[type]";
$tutr = wordwrap($r[disc]);
$tutr = bbcode(nl2br("$tutr"));
echo ''.$tutr.'';

            if ($profile[username] != "") {
echo '<a href="admin_tutorial.php?act=edit&uid='.$r[id].'">Edit</a> <a href="admin_tutorial.php?act=remove&uid='.$r[id].'">Delete</a><br />';
} else { echo '<br />'; }
}
if (!$news) {
echo "Error<br>";
echo 'All The tutorial Items Were Removed';
if ($profile[username] != "") {
echo ' | <a href="admin_tutorial.php?act=post">Add tutorial</a>';
}
}
}
?>
 
Top