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

Recommended Answers

All 7 Replies

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

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.

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

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

echo $allqts[$my_random];
?>

something like this your code should be

tried that thanks it hasnt fixed the problem

Works for me:

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

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

echo $allqts[$ranNum];
?>

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.

Would definitely be better if you can show us here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.