wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Add the -p command after -u root So its mysql -u root -p When you hit return it should now prompt for the password for the root user.
-
Use this instead: [code=php:0]$c = 0; while($pfsq = mysql_fetch_assoc($showpfsinst)) { echo ($c % 4) == 0) ? "<tr>\n" : ''; echo ' <td align="middle"><font face="Verdana" size="1" color="' . $textcolor_inst . '>' . $pfsq[FName] . ' ' . $pfsq[LName] . "</font></a></td>\n"; echo ($c % 4) == 0) ? "</tr>\n" : ''; }[/code]
-
Yeah I correct that when I posted. :)
-
Actually you are assing $row['blah'] with zero with the posted code. You use use two equal signs together, or use the empty function to check whether the the variable holds an empty value. [code=php:0]if(empty($row['field_name_here'])) { echo 'field_name_here is empty!'; }[/code]
-
Cannot modify header information - zenphoto include
wildteen88 replied to n9ne's topic in PHP Coding Help
It maynot be line 11 that is the problem, but somewhere around line 11 in test2.php. Post lines 8 to 14 here from test2.php -
PHP5 connection prob with mysql
wildteen88 replied to baiju's topic in PHP Installation and Configuration
Whats Os are you running, Windows or linux/Max? If its windows read [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this FAQ[/url] With PHP5 you need to enable the mysql_extension. If you are installing PHP on linux/mac you need to recomiple PHP with the -with-mysql command option. -
yes that should work
-
Did you make sure display errors is enabled? Also make sure PHP is actually using the php.ini by running the phpinfo() function. Look for the Configuration File (php.ini) Path row (4th row on the page that is generated). To the right of that it should state the path of the php.ini it is using, is this the correct path to the php.ini? If php cannot find the php.ini it'll say its in C:\WINDOWS\php.ini Also I am unsure what you mean by 'same problem'. What is the problem? To test that your GET and POST vars are running use this: [code=php:0]<?php if(isset($_POST['submit'])) { echo "Welcome " . $_POST['name'] . "<br />\nPOST vars are working!<br />\n<br />\n"; echo "Send this data via <a href=\"?name=" . $_POST['name'] . "\">GET</a>"; } elseif(isset($_GET['name'])) { echo "Welcome " . $_GET['name'] . "<br />\nGET vars are working!"; } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="Post"> Name: <input type="text" name="name" /><br /> <input type="submit" name="submit" value="POST Vars Test" /> </form> <?php } ?>[/code] Fill in the name field, click the button does it return what you filled in? If does click the GET link. Does it return what you filled in the name form field?
-
Do you get any errors? Also check that yoiu have error_reporting set to E_ALL and that display_errors is set to on. YOu can do this by opening the php.ini and finding the following: [code]; Print out errors (as a part of the output). For production web sites,[/code] Above that line should be the error_reporting directive. Change whats after the = sign to E_ALL Now find the following a few lines down: [code]; server, your database schema or other information.[/code] Below that line should be the display_errors directive, make sure On is stated after the equals sign. Save the php.ini if any changes where made. Now restart your server. Do you get any errors displayed? Also when you installed php did you enable the MySQL extension, as it is important you enable the this extension for any script to work if they use a MySQL database.
-
im new to this could some one please help me out.
wildteen88 replied to Renlok's topic in PHP Coding Help
If you are getting that error then you have a missing closing curly bracket (}) or a missing closing bracket ) From looking at the posted you haved closed the case or closed the swtich statment. This is why you are getting the above error. Add the following: [code] break; }[/code] before ?> at the bottom of your code. -
Use HEREDOC: [code=php:0]<?php echo <<<HTML <table width="400" border="1"> <tr> <td>{$a}</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> HTML; // DO NOT INDENT OR PUT ANYTHING ON THE LINE ABOVE ?>[/code] Or use this, not the use of the concatenation operator (.) [code=php:0]<?php echo '<table width="400" border="1"> <tr> <td>' . $a . '</td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table>'; ?>[/code]
-
The install scipts should create the tables required for the PHP script to use however you will need to first create an empty database in order for these install scripts to add the required tables to the database. You can create a new database into MySQL using phpMyAdmin which is a web based MySQL database management script you can download for free from phpmyadmin.net Could you provide the names of the scripts you are trying to install. Also which version of PHP do you have installed? And how did you install it.
-
Its becuase your expressions are exactly the same. You need to change the rewrite slightly so the expressions are unique. Such as for your secound rewrite rule have this as the url format: mysite.com/pagename/page{pageNumberHere} Where {pageNumberHere} is it'll be a number, eg: mysite.com/pagename/page1 So use this as the rewrite rule for your secound expression: RewriteRule ^([A-Za-z0-9]+)/page([0-9]+)/?$ index.php?page=$1&pagenum=$2 Now both expressions are unique Apache is able work out with expression to use, whereas before they where the same and apache couldn't see the difference between the two expressions.
-
Show the user name based on login
wildteen88 replied to hemlock's topic in Editor Help (PhpStorm, VS Code, etc)
Nasty! DW code. But the session variable you'll want use is $_SESSION['MM_Username'] -
What do you mean by 'latest rows', do you mean the last row or the last couple of rows. If its the last row and you have an auto incrementing id field you can use mysql_insert_id to grab the latest inserted record. Or if you want the last couple of rows use LIMIT and ORDER BY [code]SELECT * FROM news ORDER by id_col DESC LIMIT 3[/code] That'll grab the last 3 rows in the news table. Umm too slow shocker beat me :( ;)
-
Use $car .= trim($value) . "+" .= adds whats on the right to the end of whats on the left. It'll produce waht you want. For example: [code=php:0]$foo = 'hello'; // We for got world so we add it in: $foo .= " world"; //$foo now holds "hello world";[/code]
-
That looks like like half of the code of the function to me. Where are echoiuing $var too. Variables can be used on the same page they are created on. they cannot be used in another file.
-
make the variable global or return it Examples: [b]Global variable[/b] [code=php:0]function foobar($bar) { global $foo; $foo = 'You passed ' . $bar . ' to foobar()'; } foobar('Hello World'); echo $foo; // returns 'You passed Hello World to foobar()'[/code] [b]Return variable[/b] [code=php:0]function foobar($bar) { global $foo; return 'You passed ' . $bar . ' to foobar()'; } echo foobar('Hello world'); // returns 'You passed Hello World to foobar()'[/code]
-
You're almost there use this: [code]echo '<a href="title.php">' . $result['title'] . '</a>';[/code]
-
Thats resource holds the results from the query. It doesnt indicate whether there is any results or not. It sound like you query is failing. Echo your $sql variable: [code]echo $sql;[/code] What does it return?
-
You have a missing quote in this code, highlighted in red: mysql_query("SELECT bacoach FROM KHSAA_Schools WHERE member=\"T\" and ba=\"T\"[color=red][b]"[/b][/color]); Also remove the semi-colon on this line: while($coaches=mysql_fetch_array($coachlist))[color=red][b];[/b][/color] Your new code: [code=php:0]mysql_query("SELECT bacoach FROM KHSAA_Schools WHERE member='T\' and ba='T'") or die('Error with query:<br />' . mysql_error()); Also remove the semi-colon on this line: while($coaches=mysql_fetch_array($coachlist)) { echo vprintf("Coach: %s",($coaches[bacoach])); }[/code] I have modified it a little.
-
You;ll want look for the config.inc.php file in the root of the phpMyAdmin folder and look for the following: [code]$cfg['Servers'][$i]['auth_type'] = 'config';[/code] Change conf to http. Now goto access phpMyAdmin again. You should now get a promt requesting authentication. If you cannot find config.inc.php. Goto libaries and find config.defualt.php, copy that to the root of the phpmyadmin folder and rename that file to config.inc.php, now follow the instructions above.
-
Swap: [code] if (mysql_num_rows($result) == 0)[/code] With this: [code]$num = mysql_num_rows($result); if($num == 0)[/code]
-
Strip tags will strip [b]all[/b] html tags from a string you pass to the strip_tags function. Read up on [url=http://php.net/strip-tags]strip_tags[/url] over at php.net. You dont need a regular expression.