[PHP-DB] Hiding Admin Link

2009-04-30 Thread Joey Hendricks
Hello,
I am very new at PHP so I will try to explain my question the best I can. I was 
wondering if there was a way to have a link show only to the owner of the site? 
Like having a Admin link for editing posts, but hidden to all users except 
the owner. Thank you very much for your time!!

[PHP-DB] Image and no image

2009-05-03 Thread Joey Hendricks
Hello,
I have this set up to upload an image and if any of the fields are empty you 
get a All fields required. Now I can't figure out how to post the upload with 
or without an image. This is the code I have so far: I want to thank everybody 
so very much for all of your help!

if (isset($_POST['submit']))
{
//Grab user data
$id=mysqli_real_escape_string($dbc, trim($_POST['id']));
$user_name=$_POST['user_name'];
$image=mysqli_real_escape_string($dbc, trim($_FILES['image']['name']));
$image_type=mysqli_real_escape_string($dbc, trim($_FILES['image']['type']));
$image_size=mysqli_real_escape_string($dbc, trim($_FILES['image']['size']));
$bookname=strip_tags(trim($_POST['bookname']));
$song1=strip_tags(trim($_POST['song1']));
$song2=strip_tags(trim($_POST['song2']));
$booklink=mysqli_real_escape_string($dbc, trim($_POST['booklink']));

if (!empty($user_name)  !empty($image)  !empty($bookname)  !empty($song1) 
 !empty($song2)  !empty($booklink))
{
  if ((($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
($image_type == 'image/pjpeg'))
 ($image_size  0)  ($image_size = JGT_MAXFILESIZE))
{
if ($_FILES['image']['error'] == 0)
{
  // Move the file to the target upload folder
  $target = JGT_UPLOADPATH . $image;
  if (move_uploaded_file($_FILES['image']['tmp_name'], $target))
  {


$dbc=mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
or die('Error connecting to the server');
$query=INSERT INTO tabs (user_name, image, bookname, song1, song2, booklink) 
VALUES ('$user_name', '$image', '$bookname', '$song1', '$song2', '$booklink');
mysqli_query($dbc,$query)
or die('Error querying database.');

[PHP-DB] Paging

2009-05-11 Thread Joey Hendricks
Hi everybody, I have a paging question. I have a page where you can view a 
persons 'profile'. And I have a list taken from the db of there books. I can 
get all the books on one page but I can't figure out the WHERE from the get. 
This is what I tried but it didn't work.
$query   = SELECT COUNT(*) AS numrows FROM tabs WHERE user_name='.$_GET 
['user_name'].';
 $data  = mysqli_query($dbc, $query) or die('Error, query failed');
 $row = mysqli_fetch_array($data);
 $numrows = $row['numrows'];

When I do this it shows a second page but when I click on the next page It goes 
to my profile or the user who is logged in, not the users profile I was looking 
at on page 1. Thanks every one for all your help!!