
allworknoplay
Members-
Posts
385 -
Joined
-
Last visited
Never
Everything posted by allworknoplay
-
i got an error on this line echo "<br />name: $row['name']"; Why are you putting a slash (/) in your BR tag?
-
Do this: $result = mysql_query("SELECT name, username, interests, birthday FROM users WHERE username='".$b."' "); $row = mysql_fetch_array($result); echo "<br />name: $row['name']"; echo "<br />name: $row['username']"; echo "<br />name: $row['birthday']"; echo "<br />name: $row['interests']";
-
Where's the code?
-
Ok, well I am assuming that your GET[username] variable works? What happens when you echo out $b??
-
And how big is this INCREMENTAL_BACKUP_REPORT table?
-
Should be: $result = mysql_query("SELECT name FROM users WHERE username='$b'"); $row = mysql_fetch_array($result); echo "<br />name: $row[name]"; $result2 = mysql_query("SELECT username FROM users WHERE username='$b'"); $row2 = mysql_fetch_array($result2); echo "<br />username: $row2[username]"; $result3 = mysql_query("SELECT birthday FROM users WHERE username='$b'"); $row3 = mysql_fetch_array($result3); echo "<br />birthday: $row3[birthday]"; $result4 = mysql_query("SELECT interests FROM users WHERE username='$b'"); $row4 = mysql_fetch_array($result4); echo "<br />interests: $row4[interests]"
-
Your $row's are calling from the first query, not each individual query...
-
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
No problem, I would have rather had you use the cleaner code but it's really no biggie... I just wanted to get you on your way so you're not stuck on this all day.... -
Error log crashing server due to file size?!
allworknoplay replied to your.syndrome's topic in PHP Coding Help
Find that in your php.ini and turn it to "off". You may even be able to do this with .htaccess as long as the server allows it. Or follow what was posted above to to clear it out. Forgot about that....that's better than my suggestion.... -
Sure no problem. I am always for learning better techniques. Yes I wanted to get him the answer as soon as possible. The if/elseif/else would of course work which utilizes just 1 "exit" function...like I said, there's a lot of ways to do it... The way I wrote it is just one method. The extra "exit"'s that I put in of course was to make sure that none of the other header redirects would run....
-
Error log crashing server due to file size?!
allworknoplay replied to your.syndrome's topic in PHP Coding Help
Well you really need to fix what's causing the errors. But if you just want to clear them out just do this in linux... " > error.log " That will make the file zero. You can write a PHP program to do this, and run the cron once every 24 hours or however you wish... -
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Ok well use this code: I wanted you to use the cleaner code but just use this so you can be on your way... <?php $result = mysql_query("SELECT submission_id, col_1, name, submission_date FROM $table WHERE topic_id = '0' ORDER BY submission_id DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } $i = 0; while($row = mysql_fetch_array($result)) { $sql = "SELECT * FROM $table WHERE topic_id = " . $row['submission_id']; $comments = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); $count = mysql_num_rows($comments); $num = mysql_num_rows($result); if(($i%2) == 0 ) { $class = 'EVEN'; }else{ $class = 'ODD'; } echo '<tr class='".$class."' >'; echo '<td class="forumtd"><strong>'; echo '<a href="topic.php?id='.$row['submission_id'].'">'.stripslashes(htmlspecialchars($row['col_1'])).'</a>'; echo "</strong></td>"; echo '<td class="forumtd"><em>'; echo stripslashes(htmlspecialchars($row['name'])); echo "</em></td>"; echo '<td class="forumtd">'; echo $count; echo "</td>"; echo '<td class="forumtd">'; echo date("l M dS, Y", $row['submission_date']); echo "</td>"; echo "</tr>"; $i++; } mysql_free_result($result); ?> -
Try this: <?php //if the login form is submitted if (isset($_POST['submit'])) { if (($_POST['username'] == "login") && ($_POST['pass'] == "login")){ header("Location: http://localhost/admin/indicatedaccess.php"); exit(); } } ?>
-
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Hopefully this will work. <?php $result = mysql_query("SELECT submission_id, col_1, name, submission_date FROM $table WHERE topic_id = '0' ORDER BY submission_id DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } $i = 0; while($row = mysql_fetch_array($result)) { $sql = "SELECT * FROM $table WHERE topic_id = " . $row['submission_id']; $comments = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); $count = mysql_num_rows($comments); $num = mysql_num_rows($result); if(($i%2) == 0 ) $class = 'EVEN' : $class = 'ODD'; echo '<tr class='".$class."' >'; echo '<td class="forumtd"><strong>'; echo '<a href="topic.php?id='.$row['submission_id'].'">'.stripslashes(htmlspecialchars($row['col_1'])).'</a>'; echo "</strong></td>"; echo '<td class="forumtd"><em>'; echo stripslashes(htmlspecialchars($row['name'])); echo "</em></td>"; echo '<td class="forumtd">'; echo $count; echo "</td>"; echo '<td class="forumtd">'; echo date("l M dS, Y", $row['submission_date']); echo "</td>"; echo "</tr>"; $i++; } mysql_free_result($result); ?> -
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Ok I get it, hold on i will give you the code. -
issue with displaying price on shopping cart
allworknoplay replied to martinlucas's topic in PHP Coding Help
No problem here are some examples: <?php $price = "1.2566"; $price2 = "1.2"; echo number_format($price,2); echo number_format($price2,2); ?> You will get: 1.25 and 1.20 respectively....so you will always get the 2 decimal places to the right that you are looking for.. Please mark as SOLVED. -
90% of people are too lazy to take that time to ask someone, hire someone or to even pay attention on how to. That is absolutely DEAD ON. I have used WinXP forever without getting viruses or spyware just because I am not oblivious to websites that I go to. of course I can be tricked too but i am very careful. When people ask me for help because their PC has SLOWED down, I already know that it's NOT the PC but it's the END USERS! Knowledge is power and no one these days want to better themselves and learn how to surf the internet properly, it's too easy to just say OK, and then load spyware on their PC.... I don't even bother to clean out their systems as it's a waste of time. I just copy their important data to an external HDD and just blow out their PC.....
-
Sounds like if you want a 100% match, you should just copy everything from one table to the other table or DB. If I understand you correctly, everything would be exact except for the Workorder ID that would be different on the other DB??
-
That is very redundant. $levelRedirect = array("admin" => "http://yoursite.com/admin", "user" => "http://yoursite.com/user", "guest" => "http://yoursite.com/guest"); if (!in_array($userLevel, $levelRedirect)) $userLevel = "guest"; header ('Location: ' . $levelRedirect[$userLevel]); A bit cleaner with less code Redundant? yes....cleaner? that's perspective.... For a newbie, it's easier for them to understand the code I wrote as it's function is in your face... Your code is good and I like it, but could confuse newbies..and requires knowledge of arrays...
-
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Ok so everything is perfect now except for the rotating background colors? -
1) what the heck were you even trying to do? 2) show us some code perhaps? 3) what is your environment setup like? do you own the server? hosting it? come on, help us out here if you want help...
-
issue with displaying price on shopping cart
allworknoplay replied to martinlucas's topic in PHP Coding Help
You can look into the number_format() function. -
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Try this code, it may not work, but try it anyways... <?php $result = mysql_query("SELECT submission_id, col_1, name, submission_date FROM $table WHERE topic_id = '0' ORDER BY submission_id DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } $i = 0; while($row = mysql_fetch_array($result)) { $sql = "SELECT * FROM $table WHERE topic_id = " . $row['submission_id']; $comments = mysql_query($sql) or die("Error ". mysql_error(). " with query ". $sql); $count = mysql_num_rows($comments); $num = mysql_num_rows($result); $class = "$i % 2 ? 'EVEN' : 'ODD' "; echo '<tr class="' . $class . '">'; echo '<td class="forumtd"><strong>'; echo '<a href="topic.php?id='.$row['submission_id'].'">'.stripslashes(htmlspecialchars($row['col_1'])).'</a>'; echo "</strong></td>"; echo '<td class="forumtd"><em>'; echo stripslashes(htmlspecialchars($row['name'])); echo "</em></td>"; echo '<td class="forumtd">'; echo $count; echo "</td>"; echo '<td class="forumtd">'; echo date("l M dS, Y", $row['submission_date']); echo "</td>"; echo "</tr>"; $i++; } mysql_free_result($result); ?> -
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Wait a minute, you have two queries here, what are you trying to do exactly? -
[SOLVED] alternating table background color
allworknoplay replied to Lambneck's topic in PHP Coding Help
Ok you have to issues. 1) you have a FOR loop within a WHILE loop. 2) Don't nest your select queries within a loop!!! Let me try to fix this for you..