Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
I forgot to close one of my parentheses. Try this: $button = (isset($_GET['submit'])) ? $_GET['submit'] : "default_value"; $search = (isset($_GET['search'])) ? $_GET['search'] : "default_value";
-
Those 2 errors are referring to these lines: $button = $_GET['submit']; $search = $_GET['search']; The GET method is when variables are passed via HTTP. For example: www.yoursite.com?submit=var1&search=var2 How are you getting to this page? Does the URL resemble the above? One solution would be to check if these are set. If they are set, give $search and $button their values, if not, then you can assign them default values. Something like this: $button = (isset($_GET['submit']) ? $_GET['submit'] : "default_value"; $search = (isset($_GET['search']) ? $_GET['search'] : "default_value";
-
I understand you're new, but I told you to list the exact error messages. The other bbcodes don't work inside the code tag block. I reformatted your code and fixed all the errors that I could see. Try this: //get data $button = $_GET['submit']; $search = $_GET['search']; if (!$button) { echo "You didn't submit a keyword."; } else { if (strlen($search) { echo "Search term too short."; } else { echo "You searched for $search"; //connect to our database mysql_connect("localhost","root",""); mysql_select_db("jobjar"); //explode our search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) { $construct .= "Keywords LIKE '%$search_each%'"; } else { $construct .= " OR Keywords LIKE '%$search_each%'"; } } //echo out construct $construct = "SELECT * FROM jobs WHERE $construct"; $run = mysql_query($construct); $foundnum = mysql_num_rows($run); if ($foundnum==0) { echo "No results found."; } else { echo "$foundnum results found! "; while ($runrows = mysql_fetch_assoc($run)) { //get data $Title = $runrows['Title']; $Location = $runrows['Location']; $Salary = $runrows['Salary']; $Sector = $runrows['Sector']; $Job Type = $runrows['Job Type']; $Duration = $runrows['Duration']; $Job Ref = $runrows['Job Ref']; $Description = $runrows['Description']; echo "$Title $Location $Salary $Sector $Job Type $Duration $Job Ref $Description "; } } } } ?>
-
I mean put your code in tags like this ... code here ... . It will increase readability. As far as your code, you're changing it so much and the format is so awful I can't even follow it. Please post your entire current code in code tags. If you have errors copy and paste exactly what it says.
-
Hmm, you're not the type to learn from your mistakes, are you? You should be using curly braces, '{' and '}' for if/else blocks, foreach, etc... For the third time, use tags...
-
Please post the whole foreach code block. $x++; is perfectly fine.
-
Your foreach should be using curly braces '{' and '}'. Not parentheses. For the second time, use code tags.
-
1) What's the error? 2) Use tags.
-
[SOLVED] Help displaying information from a database.
Maq replied to The.Pr0fess0r's topic in PHP Coding Help
Looks like you're not separating the opening <?php tag and the ini_set() function. You also have an error here (Also, if you didn't fix what mikesta suggest, do so): $sql = "$sql = "SELECT * FROM recent_news WHERE status = 1 LIMIT 2"; Should be: $sql = "SELECT * FROM recent_news WHERE status = 1 LIMIT 2"; -
[SOLVED] Help displaying information from a database.
Maq replied to The.Pr0fess0r's topic in PHP Coding Help
If mikesta's suggestion isn't the solution,which it doesn't look like it will be because you have the quote in your second code block, then it sounds like there is a fatal error, usually syntactical. Try turning error_reporting on. Place these lines directly after your opening PHP tags. ini_set ("display_errors", "1"); error_reporting(E_ALL); -
Whoops, sorry about that Glad everything is working now, Danny.
-
substr_count seems to be what you're after.
-
Hehe. Is everything working properly? You should Google "PHP interpolation", and read up on some tutorials. http://www.astahost.com/info.php/Php-Interpolation_t4286.html
-
echo "</pre> <table width="'200'" border="'0'" align="'center'"> Username: {$profile['username']} Nickname: {$profile['nickname']} Clan: {$profile['clan']} Wins: {$profile['wins']} Lose: {$profile['lose']} </ta Use double quotes for your string, so your variables interpolate. Use single quotes for your attributes. You can utilize curly braces around associative arrays to escape them. You're aready in <?php tags, you can't use them again (near your variables). You also don't need to echo again since all you're really doing is giving echo a long string. Try this and see if it works, good luck. *EDIT: Fixed some associative array syntax.
-
Now everything makes sense, heh.
-
57,005. A real challenge now? Sure, here you go: http://www.claymath.org/millennium/ Pffft, only $1 million per prize? On a more serious note, a lot of those problems are very fascinating, although far too advanced for my math knowledge, I think I may have a look into one or two.
-
Yeah, I would say so. Maybe mix things up by putting some hexspeak in your geek code. I would totally make one if I had time.
-
Haha, that's priceless.
-
http://en.wikipedia.org/wiki/Hexspeak Thought you nerds would enjoy this.
-
thats possible But I think he means, if he had two domains, how would he be able to register emails his other domain for example if he visited example.com, he could register example2.com (he owns both). We're all just guessing until the OP explains exactly what they want.
-
I'm having trouble figuring out exactly what you're asking here.
-
Hehe, yeah I actually did. How did you come across this thread anyway, a search maybe?
-
User mask can't let you create executable files by default. Like I said, that would be a huge security issue. It ensures arbitrary files aren't misused as executables until you say so with an explicit chmod, at least to my understanding.
-
Because that would be a huge security issue. By default your files shouldn't be executable, although if you mkdir a directory it will be. It is picking up the permissions, just not the executable one. Why would you want everyone to have executable rights anyway?