0

Am trying to get a php script working. I have done a few reviews and corrected a few errors but it doesnt seem to work properly still. Its a quote script and instead of picking up a random quote its picking up all of them. I have tried amending the actually array parts of the code and it seems to be nothing to do with those. its more likely to be opening and closing quotes. Php file is here

<?php
require_once 'includes/facebook.php';

blurb......
?>


// Array Structure: "Quotes",

$allqts = array("quotes start and finish)


//Select a Random one.
$ranNum = rand(0, count($quotes)-1);


then on the actual quotes I have a list of all the quotes starting with the //Array and anding with the //select a random one line command and all the quotes inbetween.

So I definitely think there is an error as in I should have something at the front and the end of this section of the php. I tried putting <? ?> in at the ends but that just makes everything go blank.

thanks for any assistance

3
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by Javvy
0

Shouldn't it be count($allqts) ??

instead of $allqts = Array

I tried that no difference its definitely a <? error somewhere. I tried with it just at the beginning and ends <?php ?> but its giving a server error when i do that. So I put it in at the end of the random quotes section as an opening and closing again and at the end of the first section of script and its now displaying all the quotes but not an individual one randomly.

0
<?php
$allqts = array[" "," ",........];

$my_random = rand(0,count($quotes)-1);

echo $allqts[$my_random];
?>

something like this your code should be

0

Works for me:

<?php
$allqts = array("google", "yahoo", "bing");

$ranNum = rand(0, count($allqts)-1);

echo $allqts[$ranNum];
?>
0

tried changing it i think its another part of the code thats wrong. In the index file not that actual quotes part. Its either something is missing or something shouldnt be there that is. I dunno have tried removing and adding in <? and things like that. I just maybe need someone to go over the whole index file and find it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.