-
Posts
111 -
Joined
-
Last visited
Never
Everything posted by Branden Wagner
-
what version of MySQL are you running? what Operating System are you running?
-
do a repair table repair table users; does it return anything?
-
well if your like me you started out with Java, and then learned PHP soooo its a habit. but ive always wondered the same thing.. is there a reason? so far all ive found out it that its a matter of habit.
-
i think you might have some table corruption.. run mysql from the command line... and do this select * from users; what are the column names in order?
-
whats on line 104?
-
sorry... my fault typo... change [code]$player = mysql($result, $i, "username");[/code] to change [code]$player = mysql_result($result, $i, "username");[/code]
-
well... i have somewhat of a solution, but it requires you to do it in flash. what you do is create a flash template, and from there run the movie inside the flash, and put awatermarkd alyer over the movie... thats the only way i know it possible.. but im sure theres a server-side way. are you using windows or unix?
-
[code] $result = mysql_query("select username from users where username like '%". $find_player ."%'"); $players_found = mysql_num_rows($result); for($i=0; $i <= $players_found; $i++) { $player = mysql($result, $i, "username"); echo "<div align=\"center\">"; echo "<a href=\"profile.php?username=$player\">$player</a>"; echo "</div>"; } [/code] Try that. if it works let me know and ill explain the subtle differences.. theres very few
-
First off: In plain english explain to me what you want the search to search for. second: you have way too much code, so let me know and ill cut it down for you
-
found it!!! $_SERVER['QUERY_STRING']
-
yes but in this particular case i want to preserve the string like that, in the future there will be multiple values passed. i know there is a way to do it, and there is a global var, i just cant seem to find it.
-
what do i use to get variables behind that [code]?p=search[/code] completely intact and just tag it on to the end of the PHP_SELF var $url = $_SERVER['PHP_SELF'] . $vars.... u get the point
-
I HATE YOU ;D lol... i knew there was something simple.. Thanks... that did it.
-
[code] function find_customer($keytype,$keyword) { //Conect to DB mysql_connect($db_host, $db_user, $db_pass); mysql_select_db("$db_name") or die(mysql_error()); switch($keyword) { case "CustomerID": case "PhoneNumber": $result= mysql_query("SELECT * from Customers where $keytype='". $keyword ."'"); break; case "FirstName": case "LastName": case "CompanyName": $result= mysql_query("SELECT * from Customers where $keytype like '%". $keyword ."%'"); break; default: $result= mysql_query("SELECT * from Customers where $keytype='$keyword'"); break; } while($row = mysql_fetch_assoc($result)) { $customer[] = array( $row['CustomerID'], $row['FirstName'],$row['LastName'] ); } return $customer; } [/code] well theres my whole query function.. also i just ran the query from MySQL command line and your right it does work the way it should... but its not here(in php). suggestions?
-
I had a problem once before where for loops wouldnt work in 5 but they would in 4, i reinstalled 5 and that fixed the problem... i dont know if thats of any help.. but its just a suggestions.
-
$keytype = "LastName"; $keyword = "Smith"; $result= mysql_query("SELECT * from Customers where $keytype like '%". $keyword ."%'"); if i use it like that it returns both entries as it should for both bob and john smith. however if i search.. $keyword = "Smi"; or any other partial match it returns nothing.. what am i doing wrong? and what do i need to do SQL wildcards i thought % was a wildcard.
-
whats the proper way of making a form action call the the page its on? i usually use $_SERVER['PHP_SELF'] is there something i should be using in particular? basically i am making a form, and i have the action set to itself... is there a proper way? or a standard?
-
PHP INCLUDE CODE-SECURITY ADVICE PLEASE
Branden Wagner replied to flashback's topic in PHP Coding Help
they way i do it is by folder include("includes/". $_REQUEST['file']); that way worse comes to worse he pulled up a public file... in the includes directory i only put files that ANYONE can see -
oh wow thanks thats like 30 lines shorter then the way i was doing it.. and it works!!! lol thanks again
-
if im understanding right... [code] if( email was not sent) { include("error.php"); exit(); } else { include("thankyou.php"); exit; } // The rest of the normal form here. [/code]
-
well heres what i want to do... $customers[$i] = each customers record $customer[$i][$i2] = 0: CustomerID 1: FirstName 2: LastName Example: $customer[0][0] = 100 $customer[0][1] = Bob $customer[0][2] = Smith $customer[1][0] = 101 $customer[1][1] = John $customer[1][2] = Smith How would i accomplish using mysql_fetch_array,assoc,row?
-
sorry.. there is no error message, but it only displays the first entry. i do a search for smith... and it shows: 1 Bob Smith i do a search for john 2 John Smith there are 2 entries for smith but yet it only shows one
-
[sub][/sub]Ok, im having a problem with my for loop, and i dont know what im doing wrong. im building my own Customer administration center.... the array $customers is multidimensional [code] $num= mysql_num_rows($result); if($num > 0) { $list = array(); for($i=0;$i<count($num); $i++) { $customer= array( mysql_result($result,$i,"CustomerID"), mysql_result($result,$i,"FirstName"), mysql_result($result,$i,"LastName") ); array_push($list, $customer); } $searchresult = $list; } else { $searchresult = 0; } [/code] $customer[$i] = list of customers $customer[$i][$i2] = id, firstname, lastname (in that order) [code] echo "Total:". count($customers); echo "<table width=\"100%\" border=\"1\">"; echo "<tr align=\"center\">"; echo "<th scop=\"col\">ID</td>"; echo "<th scop=\"col\">First Name</td>"; echo "<th scop=\"col\">Last Name</td>"; echo "</tr>"; for($i=0; $i <= count($customers); $i++) { echo "<tr>"; for($i2=0; $i2 <= count($customers[$i]) ; $i2++) { echo "<td>". $customers[$i][$i2] ."</td>"; } echo "</tr>"; } echo "</table>"; [/code]
-
well i feel kinda stupid... This doesnt work: [code] crypt($password, ./[0-9A-Za-Z][rand 64,rand 64]) [/code] This does: [code] crypt($password, "./[0-9A-Za-Z][rand 64,rand 64]") [/code] all i missed were the freakin quotes, guess thats what happens when you spend too much time infront of the computer
-
redirecting to different page after having sent data
Branden Wagner replied to boonamera's topic in PHP Coding Help
you can use header(location: $url) or something like that i dont remember the exact syntax... regardless of the fact that there is code above however you cant have output any data meaning this will work [code] if($category == 0) { header(location: http://www.yoursite.com/error.php); } [/code] [code] echo "blah"; if($category == 0) { header(location: http://www.yoursite.com/error.php); } [/code] the second will fail becasue something has been output to the browser. make sense? correct syntax: [code] header("Location: http://www.yoursite.com/error.php"); [/code]