The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Apache and PHP for offline use

guarguar Registered User regular
edited June 2009 in Help / Advice Forum
I should have these set up correctly, but I'm beginning to doubt the problem is in my code, so it's possible I may have missed something. A brief overview of the code I'm trying to run,
<?php
	$link = mysql_connect('localhost', 'root');
	ERROR CHECKING
	$db = mysql_select_db('dbname');
	ERROR CHECKING
	
	$ds_u = mysql_query("SELECT count(*) FROM ds WHERE status = 'u' OR status = 'b'");
	$ds_c = mysql_query("SELECT count(*) FROM ds WHERE status = 'c'");
	$ds_tot = mysql_query("SELECT count(*) FROM ds WHERE status != 'w'");
?>

. . .

	<table class="percent">
		<tr>
			<td width="<?=$ds_u?>/<?=$ds_tot?> %">&nbsp;</td>
			<td width="<?=$ds_c?>/<?=$ds_tot?> %">&nbsp;</td>
		</tr>
	</table>

This should emulate the static version,
	<table class="percent">
		<tr>
			<td width="5/7 %">&nbsp;</td>
			<td width="2/7 %">&nbsp;</td>
		</tr>
	</table>

but it doesn't. My ERROR CHECKING doesn't return anything, so I'm assuming either 1) my code is incorrect -or- 2) none of the PHP code is being recognized. PHP is installed locally, I can check the version number and everything, but maybe I missed something when I set up Apache. I can provide more code if necessary, but those 2 snippets are the only bits I've changed from my old (working) version thus far. Is there a test file I can run with Apache to make sure it's running correctly?

guar on

Posts

  • clam2000clam2000 SeattleRegistered User regular
    edited June 2009
    The most glaring problem would be in your use of mysql_query.

    That function runs the query, but it returns a handle, not the number you're wanting.

    you'll need to call mysql_fetch_array($ds_u) to get the actual value.

    clam2000 on
    cdogwal.gif
Sign In or Register to comment.