Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
What does echo $info[0]['ComputerID']; show? I think its because your loop starts @ 1, but the array indexes starts @ 0.
-
thats a bit hard to read, so do this: echo '<pre>'; print_r($info); echo '</pre>'; It'll make it easier to read. What you're currently doing should work, but let's see if there is something else.
-
Try: foreach ($part(split('/%%/', $templateflat))) { if ($part == "search results"){ print "Search Form"; } } You were missing a )
-
echo "<div id='bldlvl$i' style='background-color: yellow; width: 100%; clear: both; border-top: 1px gray dashed; display:none;'><p>", $aftermath->listings(buildings,$i,edit), "</div>"; Should work just fine
-
Because return will break outta that loop and return that value. You need to do something like: function GetIMfromDatabase($StartTimeStamp,$EndTimeStamp){ $sql=mysql_query("SELECT * FROM msnconvosations WHERE `StartTime` BETWEEN '".addslashes($StartTimeStamp)."' AND '".addslashes($EndTimeStamp)."'"); while ($text=mysql_fetch_array($sql)){ $array[] = $text; } return $array; }
-
i got an error on this line echo "<br />name: $row['name']"; Why are you putting a slash (/) in your BR tag? @allwork: In xhtml you have to close the tags, thus requiring a /> @OP: we're pretty much giving you the same code. Do you get any errors when you run: <?php session_start(); if(!isset ($_SESSION["gatekeeper"])) { echo "Sorry, You are not logged in please try again! <a href=\"home.html\">login</a> "; } else { ?> <?php $a = $_SESSION["gatekeeper"]; $b = $_GET["username"]; echo "You are viewing $b profile:"; $conn = mysql_connect("localhost", "*****", "******"); // dont forget to change password mysql_select_db("ccheckley"); $result = mysql_query("SELECT `name`,`birthday`, `interests` FROM `users` WHERE `username`='$b' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($result); echo '<br />name: ',$row['name']; echo '<br />username: ',$b; echo '<br />birthday: ',$row['birthday']; echo '<br />interests: ',$row['interests']; ?> <?php } ?>
-
<?php session_start(); if(!isset ($_SESSION["gatekeeper"])) { echo "Sorry, You are not logged in please try again! <a href=\"home.html\">login</a> "; } else { ?> <?php $a = $_SESSION["gatekeeper"]; $b = $_GET["username"]; echo "You are viewing $b profile:"; $conn = mysql_connect("localhost", "*****", "******"); // dont forget to change password mysql_select_db("ccheckley"); $result = mysql_query("SELECT `name`,`birthday`, `interests` FROM `users` WHERE `username`='$b' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($result); echo '<br />name: ',$row['name']; echo '<br />username: ',$b; echo '<br />birthday: ',$row['birthday']; echo '<br />interests: ',$row['interests']; ?> <?php } ?> A few things I noticed... You can condense that query into 1 query, and you can use LIMIT, since you were only needing one row. Also, no need to call username, if $b is username If that doesn't work: find: $row = mysql_fetch_array($result); replace with: $row = mysql_fetch_array($result); echo '<pre>'; print_r($row); echo '</pre>';
-
Find: $_SESSION['SESS_LOGGEDIN'] = TRUE; $_SESSION['SESS_LNAME'] = $lname; $_SESSION['SESS_HUB'] = $hub; $_SESSION['SESS_FNAME'] = $fname; $_SESSION['login'] = $login; $_SESSION['status'] = $status; Add above: echo $login;
-
If / Else Multiple conditions? Is this possible?
Philip replied to Skipjackrick's topic in PHP Coding Help
Something like: <?php // query $querymembers = "SELECT * FROM `anglers` WHERE `team_id`='$teamvar' GROUP BY `angler` LIMIT 5"; $teamanglers = mysql_query($querymembers) or die(mysql_error()); // get count of how many rows $rowCount = mysql_num_rows($teamanglers); // let's get the results into an array while($row = mysql_fetch_assoc($teamanglers)) $results[] = $row; // what do we have? switch($rowCount) { case 3: $results[3]['angler'] = 0; $results[3]['handle'] = 'vacant'; $results[3]['name'] = 'vacant'; $results[3]['kayak'] = 'vacant'; // since you wanted if 3 rows to set [4] as well, then we won't place a break here. case 4: $results[4]['angler'] = 0; $results[4]['handle'] = 'vacant'; $results[4]['name'] = 'vacant'; $results[4]['kayak'] = 'vacant'; break; default: // do nothing I suppose break; } ?> -
If / Else Multiple conditions? Is this possible?
Philip replied to Skipjackrick's topic in PHP Coding Help
As should the next if statement I just don't understand why you're pulling stuff from a database, and then setting the result array to another value: $results[3]['angler'] = 0; -
If / Else Multiple conditions? Is this possible?
Philip replied to Skipjackrick's topic in PHP Coding Help
Umm, what exactly are you trying to do with your script? -
Well, technically, isn't mysql_numrows() deprecated? Anyways, change: $result = mysql_query($q); to: $result = mysql_query($q) or die(mysql_error());
-
mysql_num_rows, perhaps?
-
You should define the variable. Where do you currently create $_SESSION['login']?
-
So, you only have one session variable set, and that's $_SESSION['SESS_LOGGEDIN']
-
$slogin = $_SESSION['login']; It means there is no index in the array with the key of login. In otherwords, $_SESSION['login'] doesn't exist. Under session_start(); put: echo '<pre>'; print_r($_SESSION); echo '</pre>';
-
Have you tried placing memory_get_usage() in places you think might consume a lot of memory?
-
$path="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\upload\". " " .$_FILES["file"]["name"]. " " .$tp =$_FILES["file"]["type"]; Maybe you can see what it's doing that with some highlighting $path="C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\upload\\".$_FILES["file"]["name"].$tp.$_FILES["file"]["type"]; You needed to escape the quotes
-
I'm sorry, mysql_free_result(); should be: mysql_free_result($result); I also figured that the script would take longer than 60 seconds, again:
-
<?php $gold = '<td class="td" align="Right">968.00</td>'; preg_match_all('~<td class="td" align="Right">(.+?)</td>~is', $gold, $goldMatch); echo str_replace('<td class="td" align="Right">(.+?)</td>', '(.+?)', $goldMatch[0][0]); ?> Outputs 968.00
-
What is the value of $row['sort'] show?
-
edit, you got the image working. Anyways, the questions appearing after one is answered can be done with plain old javascript, unless you want them saved after the answer the question (then that would become ajax.) I'd recommend using radio buttons instead of checkboxes for yes/no questions, so they can only select one option.
-
It happens to the best of us