wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Yes you can. You'll need to setup a link identifier when you connect to the mysql servers. Then when you use any mysql function that requires a link identifier (second parameter for function) you must provide it, Heres an example of how to use the link identifier: <?php // connect to mysql server 1 // $server1 variable is the link identifier for sending queries to server1 $server1 = mysql_connect('server1.mysite.com', 'server1username', 'server1password'); // connect to mysql server 2 // $server2 variable is the link identifier for sending queries to server2 $server2 = mysql_connect('server2.mysite.com', 'server2username', 'server2password'); // select database for server1: mysql_select_db('server1database', $server1); // select database for server2: mysql_select_db('server2database', $server2); // NOTE: We have used the link identifier above in the second parameter for mysql_select_db function. We do this for all mysql_* functions that accept link identifiers. here is a few more // query server1: $qry1 = mysql_query("SELECT * FROM table", $server1); // get results from query1: $rows = mysql_fetch_array($qry1); // query server2: $qry = mysql_query("SELECT * FROM table", $server2); // get results from query2: $rows = mysql_fetch_array($qry2); // NOTE: We don't provide a link identifier for mysql_fetch_* functions. They only require the resource identifier which passed down from a call to mysql_query. // close connection to servers: mysql_close($server1); mysql_close($server2); ?> EDIT: Frost beat me
-
OK. Hold it there chaps. PHP is not reading Jimmy058910's php.ini file. So anything you do to the php.ini wont matter. Also PHP only searches in C:/WINDOWS, C:/WINDOWS/System32 or the Windows Path and/or Registery for the php.ini. If the Configuration File (php.ini) Path line is set to just C:/WINDOWS or the Loaded Configuration File line is set to nothing. then then PHP is not reading any php.ini file and is using the default php.ini settings built in to php itself. As you have the php.ini C:/php instead I would suggest you add the PHP folder to the Windows Path. To do so go to Start > Control Panel > System > Advanced Tab > Environment Variables button. Now scroll down the list of variables in the System Variables box and select PATH. Now press the Edit button. After you have done that, immediately press the End key on your keyboard. This will send the cursor to the very end of the text field (which should stop you from deleting anything already set within the PATH variable). Now type the following exactly: ;C:\php;. Now press Ok for all open windows to close them. Now restart Windows for the changes to take affect When you log back into Windows run the phpinfo function again within a .php file and check that PHP is now reading your php.ini located in C:/php by again looking at the Configuration File (php.ini) Path or Loaded Configuration File line. One of those two lines should be now set to C:/php/php.ini. If they are php is now reading your php.ini file. Any changes you make to the php.ini should be loaded. NOTE: When you make any changes to the php.ini you must restart your server (eg: Apache, IIS etc) for the changes to take affect.
-
This is down to the behaviour of the browser itself. Different browsers react differently. I don't think you can change this behaviour through CSS.
-
you must use double quotes and not single quotes when you use whitespace characters (\n, \r \r\n). When you sue whitespace characters in single quotes PHP will treat them as normal text and not there special meaning. You'll have to change this line: print '<a class="sidelink" href="http://www.lds.org">LDS Church</a><span class="hide"> | </span>\n'; to: print "<a class=\"sidelink\" href=\"http://www.lds.org\">LDS Church</a><span class=\"hide\"> | </span>\n";
-
$_SERVER['HTTP_REFERER'];
-
Line breaks written to file do not show up.
wildteen88 replied to dlite922's topic in PHP Coding Help
I guess you are using notepad to view the file. Notepad only understands \r\n. When use \r or \n for new lines and display it in notepad all you'll get is square characters in placement of those chars. Change \n to \r\n and you'll see the new lines. -
The code metrostars provided will work correctly however all you'll get is a blank list. That's because the generated code for the list is incorrect. echo "<option value=\"".trim($row["font"])."</option>\n"; That line will produce this: <option value="Arial</option> As you can see that is correct atall. It should be like this: $font = trim($row["font"]); echo "<option value=\"". $font ."\">" . $font . "</option>\n"; with now produces this: <option value="Arial">Arial</option> Ad that change and the code should work
-
Yes MySQL pulls data out of the data in order they are stored in the table, eg if ferrari was entered first and jaguar was entered second the mysql will pull Ferrari first followed by jaguar. You can change the order by using the ORDER BY clause within the query if you wish.
-
question about session_start function
wildteen88 replied to saeed_violinist's topic in PHP Coding Help
session_start always checks whether there was a valid session id used previously. The session id is normally stored in a cookie. This id is relates to a session file stored on the server. PHP then compares those two to see if the session is still valid, eg the session has not timed out or whether the session file exists. You can call session_start as many times as you like, eg: <?php session_start(); $_SESSION['blah'] = 'hello'; session_start(); The second call to start the session will just get ignored. PHP will not reset any of the session variables unless you have told it to kill the session using either session_destroy or unset. Or whether the session has been timed out or when you delete your cookies on your computer/browser. -
Has mail been setup in the php.ini to use an SMTP server. Also mail only checks that the headers are ok. It doesn't check whether the email has been sent or received or not. Another thing to check is your spam/junk (in)box(es). Alot of the time PHP emails get sent to spam/junk.
-
There is no standard php.ini file as php setups can vary. Your php.ini file is probably setup correctly. The problem lies with PHP loading the mysql extension. Can you enable a setting called display_startup_errors too within the php.ini. When you restart Apache errors should be displayed if PHP is having problems when Apache starts up. Also can you verify that php is using the php.ini file you are editing? You can check this by running phpinfo(); and then looking at the Configuration File (php.ini) Path or Loaded Configuration File line. One or the other should be set to the full path of loaded php.ini file, eg if your php.ini is in C:\WINDOWS one of the lines should read C:\WINDOWS\php.ini. If none of lines end with php.ini then PHP has not managed to load the php.ini I know this can be very frustrating. We get these sort of posts all the time.
-
The output is starting on line 1 in details.php. The error is being flaged up on line 6 in check.php. details.php is the problem file not check.php. Check details.php that there is no output on line 1.
-
If no mysql info is shown when you run phpinfo then PHP has not loaded the mysql extension. Have you enabled the mysql extension in the php.ini (php_mysql.dll) and that you have setup extension_dir to point PHP's extensions folder (eg: C:/PHP/ext). Also add PHP to the Windows PATH variable too. Any changes you make to the php.ini or IIS's configuration you must restart IIS. Also if you change the PATH you must restart Windows also.
-
Try not to install PHP within Apaches directories. Install Apache and PHP in separate directories eg C:/Apache and C:/PHP. Never move any files outside of the PHP directory or the Apache directory. Only add the PHP directory (C:/PHP) to the path no other files/folders. When you start moving files outside of directories you can cause more problems than needs be. Especially when you want to upgrade a component. Also I have found having spaces within paths may/can cause problems. I prefer to install AMP in C:/Server which is set out like so: C:/Server | +-- Apache +-- PHP +-- MySQL +-- www I find this being the optimal set-up.
-
You'll want to use preg_match within a while loop and then with each match found you'll then use preg_replace. I'll back with some code in abit.
-
as your title says - mysql_connect Please read the php manual: PHP MySQL manual. If you are new to MySQL and PHP. Have a read through the tutorials over at http://www.php-mysql-tutorial.com
-
You are using vbsNews not 123News. That is the script you got me to download earlier. When I installed that script on my dev server. In footer of the generated page it linked to here.
-
As you are disabling that form field when you press it the browser will exclude it in POST data. What you might want to do is hide the button when it is clicked and then display a message in replacement eg: <?php if(isset($_POST)) { echo '<pre>' . print_r($_POST, true) . '</pre>'; } ?> <script type="text/javascript"> function hide_btn(sbt_btn) { // Dide the submit button when clicked sbt_btn.style.display = 'none'; // Display a message in replacement document.getElementById('submit_btn_msg').style.display = 'block'; } </script> <form action="" method="post"> Name: <input type="text" name="username" /><br /> Password: <input type="password" name="password" /><br /> <input type="submit" id="sbt_btn" name="RE_Submit" value="Register" onclick="hide_btn(this);" /> <!-- the following will be shown when the form is submitted and the submit button will disappear --> <span id="submit_btn_msg" style="display:none">Registering...</span> </form>
-
I only suggested cuteNews instead of vbsNews as cuteNews is stable, popular and basically the same as vbsNews. So I'd say use cuteNews if you can't get vbsNews to work.
-
mysql_fetch_array returns both an associative array (eg $row['id'], $row['name'] etc) and a numerical array (eg: $row[0] - first row, $row[1] - secound row). mysql_fetch_array does have an optional second parameter for what type of array you want that function to return. The options are MYSQL_ASSOC, MYSQL_NUM, or MYSQL_BOTH (default) MYSQL_ASSOC - return an associative array (same as mysql_fetch_assoc()) MYSQL_NUM - return a numerical array (same as mysql_fetch_row()) MYSQL_BOTH - return both an associative array and numerical array (default behaviour). mysql_fetch_assoc returns just an associative array.
-
No not the server clear your browsers cookies for your site - clearing any cookies set for sessions. if the problem persists have a word with your host.
-
Umm. Had a look at the script. index.php and install.php work fine for me. However having hard time getting the news to display. I'd say dump that script. Go for something better such as cuteNews.
-
Can you access your sites error logs? If you can have look in there If there is anything wrong it should be logged in there. Before looking in the error log run your script again then look in the error log. The latest error logged should be posted either at the end of the error log or at the top. Also can you post a link to 123news I cannot seem to find it. I just get French sites
-
What is the "strange stuff". Also could you post the table structures for mesgs and users table.
-
Umm that code is fine. Looks like your PHP session is is currupt. Try clearing your cookies for your site. Does the error persist?