Jump to content

raryre23

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

raryre23's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I haven't used PHP a while so I'm a bit stuck here.. This is my index page code: <?php require ("config.php"); include("functions.php"); $ses_username = $_SESSION['ses_username']; $cmd = isset($_GET['cmd'])?$_GET['cmd']:1; switch($cmd) { case 1:$file="main.php"; break; case 2:$file="signup.php"; break; } include("header.php"); ?> <div align="left"> <?php include($file); ?> <br> </div> <div align="left"> <?php include("footer.php"); ?> I cut out some of the cases, there's actually about twenty. But what i need to do is check that the command exists and then, if it doesn't, just display my own error message. At the moment, if i change the address from something like "http://www.mysite.com/index.php?cmd=2" to "http://www.mysite.com/index.php?cmd=25" (cmd=25 doesn't exist) then I get: Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/php5/lib/php') in ..... Any help would be great
  2. Firstly I'm not even sure if it should be a for loop or whether it should be a while one, or what the difference even is. But anyway it seems to be working fine apart from one thing. It's meant to display up to seven images one after each other but the problem is that if there is any less than seven images in the database then it just displays all of the images it has and then error messages. How can I get it so that it does not display any error messages? <?php $sql="select * from images where (username= '$username') ORDER BY picurl"; $res=mysql_query($sql); for($i=0; $i < 7; $i++) { $picurl= mysql_result($res,$i,"picurl"); ?> <img src="<?php print $picurl ?>" /> <?php } ?> Any help would be greatly appreciated.
  3. I'm a relative beginner to PHP and cant work out what is going on here!! I have some code which works fine in Firefox and Safari but when I tried it on Internet Explorer it doesn't display an image like it does in the other two but it displays nothing. If someone could help me out it would be appreciated! <?php $sql="select * from ratepics where (username= '$username' AND '$hname' = hname)"; $result=mysql_query($sql); $obj=mysql_fetch_object($result); $thumburl=$obj->thumburl; $url=$obj->url; $id=$obj->id; if(mysql_num_rows($result) > 0 ) { ?> <div align="center"> <p><a href= '' onClick="MM_openBrWindow('<?php print $url?>','','')" ><img src="<?php print $thumburl ?>" alt="" name="" width="" height="" border="0"></a></p> <p> </p> </div></td>
  4. im very unexperienced with PHP and was wondering if someone could help me with this script: <td height="19" align="center"> </td> <td height="19" colspan="4" align="center" ><? print $pic;?></td> </tr> i need to make it so that the picture that is printed is resized if the width is over 400 wide and then the height to be resized in proportion. i realise that there are probably millions of other topics linked to this but i am so clueless when it comes to php that i am unable to apply their answers to my case. any help would be appreciated!!
  5. I have downloaded a script for my website which displays a random picture on the front page that a member has uploaded. I realise that i should rezize the photos when they are uploaded but this is just too complicated for me and i would like to know how to just rezize the photo when it is actually loaded on the homepage. i know that there is probably other similar posts but i wouldnt have a clue how to apply their answers to my problem (due to my complete lack of php). im guessing the rezizing bit goes in here somewhere: <tr valign="middle" > <td height="19" align="center"> </td> <td height="19" colspan="4" align="center" ><? print $pic;?></td> </tr> <tr valign="middle" > <td height="19" align="center"> </td> <td height="19" colspan="4" align="center" > </td> </tr> any help would be appreciated!
  6. i downloaded a script for my website which amoungst other things allows users to search for members of the website. however i am intending to use this search as a search for horses instead and so i need to change the script so that instead of looking in the database for M or F (gender of people), it instead looks for S, G or F (the different genders of horses). Im sure it is fairly simple and probably the most basic PHP - i just dont ahve a clue when it comes to PHP! im guessing something here should be changed: $sheading="Search Results"; $lextra="&listpics=$listpics&gender=$gender&age1=$age1&age2=$age2"; if($listpics=="Y") { $sql="select distinct(members.username) from members,photos where members.username=photos.username and approved='Y' and age>=$age1 and age<=$age2 and active=1"; } else { $sql="select distinct(members.username) from members where age>=$age1 and age<=$age2 and active=1"; } if($gender=="M") { $sql=$sql." and gender='M'"; } else if($gender=="F") { $sql=$sql." and gender='F'"; any help would be appreciated... thanks
  7. I downloaded a script for my website which, amongst other things, allows people to upload photos. However at the moment it doesnt resize the photos when they are uploaded and if they are too big they takeover the whole of the persons profile page. I have absolutely no php knowledge but i think the part of the php script that is about uploading photos is this: <tr> <td valign="top"> <div align="center"> <table width="100%" height="100%" border="0" align="left" cellpadding="0" cellspacing="0"> <form name="myform" action="index.php?cmd=6" method="post" onsubmit="javascript: return checkifvalid();" enctype="multipart/form-data" > <input type="hidden" name="addpic" value="1"> <tr > <td width="1" class="header"> </td> <td height="20" colspan="2" class="header">Add a Picture</td> </tr> <? if($uperror!="") { ?> <tr > <td height="25" class="normal"> </td> <td height="25" class="normal" colspan="2"><b><? print $uperror; ?></b></td> </tr> <? } ?> <tr > <td height="25" class="normal"> </td> <td height="25" class="normal">Image URL</td> <td height="19" align="left" class="normal"> <input name="url" type="text" class="mytext" id="url" size="40"></td> </tr> <tr > <td height="25" class="normal"> </td> <td height="25" colspan="2" class="normal">for eg.http://www.abc.com/abc.gif</td> </tr> <tr > <td width="1" height="25" class="normal"> </td> <td width="135" height="25" class="normal"><strong>OR</strong> Select a Picture</td> <td width="281" height="19" align="left" class="normal"> <input class="mytext" name="uppic" type="file" id="uppic"></td> </tr> <tr align="center" > <td height="25" colspan="3" class="normal"> <input type="submit" name="Submit" value="Add Picture" class="mybutton"></td> </tr> so im wondering where abouts in that script i put something about resizing and what do i write? Any help would be appreciated.
  8. could it perhaps be some limitations on my hosting account that is causing the problems?? i am on godaddy economy hosting..?
  9. it doesnt make a difference when i change it to just "localhost".....thats what i meant by no change without the port! ive logged in to my database with username and password so im guessing they are right....the only things left to be wrong are the dbserver and dbname........but im pretty sure they are right....
  10. forgive my ignorance but i really am a beginner at this.........selecting the database from the command line? there are lots of different php scripts but according to the instructions the one called config.php is the only one i am meant to change. The whole of config.php goes like this: <? $dbServer = "localhost:3306"; $dbuserName = "kaikohe2"; $dbpassword = "******"; $dbName ="kaikohe2"; ///////////////////// DO NOY EDIT BELOW ///////////////////////////////////////// $con=mysql_connect ($dbServer, $dbuserName, $dbpassword) or die ('Cannot connect to the database.'); $db=mysql_select_db ($dbName); session_start(); I dont know if thats anymore helpful?
  11. nope thats all correct!! i tried changing it to localhost but same problem!
  12. i am new to php and have downloaded some script. the instructions told me only to edit this bit to connect it to a mysql database: $dbServer = "h41mysql19.secureserver.net"; $dbuserName = "kaikohe2"; $dbpassword = "**********"; $dbName ="kaikohe2"; i really dont know where ive gone wrong? whenever i try and anything that uses the script it says "cannot find database". my website is hosted on godaddy and i have made databases using both versions 4.1 and 5.0 to see if i makes a difference. any help would be appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.