Jump to content

print_r()


aebstract

Recommended Posts

<?php

$server = 'ww26.empiredatatech.com';
$link = mssql_connect($server, 'outlaw', 'out98765law');






$query = mssql_query("SELECT * FROM aspnet_Membership");
while($r=mssql_fetch_array($query)){
echo "<pre>";
print_r($r);
echo "</pre>";
echo "hi";
}



?>

 

The question I have here is, what content can you place inside print_r() that will cause a white page? I have some tables that show and some that will produce a white page, so there has to be some sort of character or something that I need to strip out to be able to display my results? Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/
Share on other sites

Your query is either failing (due to things like a table name that does not exist, in which case $query will contain a FALSE value) or the query is returning zero rows (in which case mssql_fetch_array() will return a FALSE value and the WHILE() loop will be skipped over.)

 

Real code (code that will tell you when and why it is failing) must test if the query worked ($query is not a FALSE value) and should use mssql_num_rows() to test how many rows were returned before ever executing a WHILE() loop to fetch data from the result set.

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/#findComment-1011380
Share on other sites

try this

 

 

$server = 'ww26.empiredatatech.com';

$link = mysql_connect($server, 'outlaw', 'out98765law');

 

 

 

 

 

 

$query = mssql_query("SELECT * FROM aspnet_Membership");

$fel=mysql_num_fields($result);

$result= mysql_query($query,$link) or die("");

$nro=mysql_num_rows($result);

while($r=mssql_fetch_array($query)){

echo "<pre>";

print_r($r);

echo "</pre>";

echo "hi";

}

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/#findComment-1011383
Share on other sites

$query = mssql_query("SELECT * FROM aspnet_Membership");
if(mssql_num_rows($query) > 0){
while($r=mssql_fetch_array($query)){
echo "<pre>";
print_r($r);
echo "</pre>";
}
} else {
echo "broken";
}

 

broken is displayed on the page. The table does exist and there is information in it.. I know it exists because it shows up when I display all tables in my database and there has to be information because that is the table that stores user's passwords.

 

 

 

jaiffed: that gives me a white page as well

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/#findComment-1011388
Share on other sites

Echo mssql_get_last_message() as part of your error reporting logic to find out any additional information.

 

Is that the only or the first mssql_query() on the page, because -

Note: If the query returns multiple results then it is necessary to fetch all results by mssql_next_result() or free the results by mssql_free_result() before executing next query.

 

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/#findComment-1011389
Share on other sites

I'm assuming that's all on the host's end of things? They are actually really terrible and I would not doubt that it isn't up to date at all. This could be a big issue, because I noticed it doing this with a few other tables.. some tables show though. =[

 

With that being said, is there anything at all imaginable that might work to get this information?

Link to comment
https://forums.phpfreaks.com/topic/191879-print_r/#findComment-1011397
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.