peranha
Members-
Posts
878 -
Joined
-
Last visited
Everything posted by peranha
-
[SOLVED] Why won't this mysql line work?
peranha replied to AStrangerWCandy's topic in PHP Coding Help
INSERT INTO users ('user_Id', 'userName', 'pass', 'firstName', 'lastName', 'country') VALUES ('id4a99b9563701d', 'abcd', 'abcd', 'abcd', 'abcd', 'United States') try that, it is because of the Space between Unite and States. -
Is mail set up in your php.ini file for the new hosting company?
-
what you are looking for is BBcode.
-
$_SERVER['HTTP_REFERER']
-
I want to open a directory, and get all the images in that folder and display them to the webpage No databse, just a directory of pics. Here is what I have. getimage.php page. <?php $path = "C:/pics"; //images them dir //$patha ="C:/pics"; $dh = opendir($path); while ($file = readdir($dh)) { if($file != "." && $file != "..") { $extension = substr($path, -3); if($extension == "jpg" || $extension == "jpeg"){ header("Content-type: image/jpeg"); }elseif($extension == "gif"){ header("Content-type: image/gif"); }elseif($extension == "bmp"){ header("Content-type: image/bmp"); } $path = "$path/$file"; readfile($path); } } closedir($dh); // close dir ?> Here is how it is called on the page. images1.php <?php echo "<img src='getimage.php' alt='' width=100 />"; ?> Currently it gets the first image in the directory, but every image after that, it adds the first image file name to the $path variable. example img1 = P3140722.JPG img2 = P3140722.JPG/P3140723.JPG img3 = P3140722.JPG/P3140723.JPG/P3140724.JPG etc.... Any ideas?
-
Thanks, cant believe I forgot to set the variable on the main page.
-
Here is my usage. <?php $profile->retrieve_username($userid); echo $username; ?> if I change the functio to <?php // Function to retrieve user name. public function retrieve_username($userid) { $ruq = mysql_query("SELECT user_name FROM " . $this->pre . "users WHERE user_id = '{$userid}'"); $r = mysql_fetch_array($ruq) or die(mysql_error()); $username = $r[0]; echo $username; } ?> "peranha" is outputted to the screen, so $username is set, just wont return with return $username. Am I not using it right?
-
Is there a way to return a variable from a function inside a class? Ex. <?php // Function to retrieve user name. public function retrieve_username($userid) { $ruq = mysql_query("SELECT user_name FROM " . $this->pre . "users WHERE user_id = '{$userid}'"); $r = mysql_fetch_array($ruq) or die(mysql_error()); $username = $r[0]; return $username; } ?> Then I need to use the variable $username in another function. if I echo $username in the function, it will display "peranha", but if I echo $username on the page itself, it doesnt return anything.
-
The css link goes in the head of the document. <head> <link rel="stylesheet" href="/styles.css" type="text/css"> </head>
-
[SOLVED] Storing mysql query results into a php array.
peranha replied to dont_be_hasty's topic in PHP Coding Help
See if this works for you mysql_num_rows($result1) -
Yeah, never use short tags as this will happen, because some servers dont support it. Always use the full <?php tags.
-
change the <? to <?php in the following code <? } elseif ($errorStr != '') { print $errorStr; } ?> I dont think that godaddy supports php short tags. I never got them to work. Also use [ code] [ /code] tags (without the space) it color codes things and makes it easier to read. Also what is the \ for here if($sent == 1 && isset($_POST['submit']) ) {\
-
Nothing in the code should make you login twice.
-
you need session_start(); on the page.php code as well.
-
[SOLVED] Need help with pulling data from two tables...
peranha replied to galvin's topic in MySQL Help
$sql = "SELECT RB.playerid, RB.teamid, O.week1opp FROM runningbacks RB INNER JOIN opponents O ON RB.teamid = O.teamid; try that and see what you get. -
w3schools read the manual at php.net. Look at the tutorials on www.phpfreaks.com/tutorials do a google search, lots of info will come up.
-
yes that is output, it cannot be before session_start(). put session_start at the very top of the page before anything. <?php session_start(); ?> <html> <head> etc...
-
session_start() that has to be at the top of the page before any output is sent. including blank lines.
-
Are you getting any errors? Not sure, but I believe you need to join the tables somehow. SELECT * FROM ContentSub CS INNER JOIN Plugins P ON CS.tablefield = P.tablefield WHERE CS.Content_ID = 'PreDefinedID' AND CS.Plugin_ID = P.PluginID OR CS.Default = 'Y' AND CS.Plugin_ID = P.PluginID
-
Apache comes with the WAMP installer, you do not install it separately.
-
He specifically said that it was during the registration process. yeah, and he is getting the capture error for his password being invalid.
-
Everything looks closed to me try putting this at the top of the file and see if anything displays. ini_set ("display_errors", "1"); error_reporting(E_ALL);
-
var gallery4=new virtualpaginate({ piececlass: "virtualpage4", piececontainer: 'div', pieces_per_page: 1, defaultpage: 0, persist: true }) try changing pieces_per_page and see what that does. that is from HTML code block.
-
[SOLVED] How to use (if) to check $var is $this OR $that
peranha replied to phpdragon's topic in PHP Coding Help
if (($_SESSION["type"] != 'admin') || ($_SESSION["type"] != 'reseller')) That says if ((session type does not equal admin) or (session type does not equal reseller)) if (($_SESSION["type"] == 'admin') || ($_SESSION["type"] == 'reseller')) That says if ((session type is equal to admin) or (session type is equal to reseller)) -
[SOLVED] Quicky: How do display default text in a regular text box?
peranha replied to webmaster1's topic in PHP Coding Help
You way want to make sure that they are free from sql injections and XSS attacks so you dont get hacked.