User Profile

Collapse

Profile Sidebar

Collapse
cherryst152
cherryst152
Last Activity: Mar 23 '08, 11:07 PM
Joined: Nov 7 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • cherryst152
    replied to array from query then random gen. of array
    in PHP
    works properly now. finished code below.

    $query = "SELECT Id FROM January WHERE Username='0' AND Day='1'";
    $result = mysql_query($qu ery);

    $data = array();
    while($row=mysq l_fetch_assoc($ result))
    {
    $data[] = $row['Id']; // store in array
    }

    $random = array_rand($dat a, 10); // get 10 random keys

    foreach ($random as $key)
    {
    ...
    See more | Go to post

    Leave a comment:


  • cherryst152
    replied to array from query then random gen. of array
    in PHP
    that definitely helped and put things in a more logical perspective. thanks. however, i remain with the same original problem. i feel as though this problem is because the array which i am trying to carry over from the while loop is not reading in the for loop. any further suggestions?
    See more | Go to post

    Leave a comment:


  • cherryst152
    replied to array from query then random gen. of array
    in PHP
    $_query = mysql_query("SE LECT Ad_Id FROM January_Ad1 WHERE Username='0' AND Day='1'");

    function rand_from_array ($_data)
    {
    for($_i = 0; $_i < 10; ++$_i)
    {
    echo array_rand($_da ta);
    }
    }

    while($_row=mys ql_fetch_assoc( $_query))
    {
    echo rand_from_array ($_row) . "<Br />";
    }
    See more | Go to post

    Leave a comment:


  • cherryst152
    replied to array from query then random gen. of array
    in PHP
    When i tried that, all i get was 'Id' listed way too many times.
    See more | Go to post

    Leave a comment:


  • cherryst152
    started a topic array from query then random gen. of array
    in PHP

    array from query then random gen. of array

    I'm trying to make an array from a query and then randomly select 10 values from the array, but the error i keep getting is that it's not reading as an array. Thanks in advance for anyone who can help.

    $query = "SELECT Id FROM January WHERE Username='0' AND Day='1'";
    $result = mysql_query($qu ery);

    while($row=mysq l_fetch_assoc($ result))
    {
    echo $row['Id'];
    echo "<br>";...
    See more | Go to post

  • cherryst152
    replied to random number generator-- need separation
    in PHP
    bump... please... any help is appreciated
    See more | Go to post

    Leave a comment:


  • cherryst152
    started a topic random number generator-- need separation
    in PHP

    random number generator-- need separation

    Ok, so i have a php random number generator that creates two unique numbers between 1 and 10, what i want to add that i can't figure out for the life of me is how to implement that these two numbers will always have a separation of 4. For example, 1 and 6...or even 2 and 9.... but never 2 and 3... or 4 and 7.

    <?php
    $arr=array();
    while(count($ar r)<2){
    $x=mt_rand(1,10 );
    if (!in_array($x,$ arr)){...
    See more | Go to post

  • cherryst152
    replied to getting a drop down list value with php?
    in PHP
    php if possible, thanks
    See more | Go to post

    Leave a comment:


  • cherryst152
    started a topic getting a drop down list value with php?
    in PHP

    getting a drop down list value with php?

    I am trying to grab the values of a couple drop down lists. Now i know what i have isn't right, but i feel close.

    <select name="os1">
    <option value="1">1
    <option value="2">2
    <option value="3">3
    </select>

    <select name="os2">
    <option value="a">a
    <option value="b">b...
    See more | Go to post

  • cherryst152
    replied to How do I insert specified time as a query?
    in PHP
    nvm, found that there were two inserts in the query.


    thanks again though for the help!
    See more | Go to post

    Leave a comment:


  • cherryst152
    replied to How do I insert specified time as a query?
    in PHP
    that worked very well and thanks for the fast response! only problem i am still having is getting it to insert into the database. it prints it out fine separately, but it's not being queried into the database even after i added in the line $result=mysql_q uery($query);
    See more | Go to post

    Leave a comment:


  • cherryst152
    started a topic How do I insert specified time as a query?
    in PHP

    How do I insert specified time as a query?

    while($i=01:00; $i<=01:10; $i++){
    $query= "INSERT INSERT INTO $January_Ad1 (Day, Time) VALUES ('1','$i')";
    $result= mysql_query($qu ery);
    }

    I want to insert 11 rows that say the Day is 1 and the time is incremented by 1 such that the time would read 01:00, 01:01, 01:02... 01:10.
    See more | Go to post

  • it should be one row no matter what if there are unique Days (such as Day 1).
    I'm just lookin to see if it's possible to display not all the column names at once, but rather specificy (maybe not even from a query--i dont really know) when a column has a certain value within a certain row and to select that certain column. maybe i shouldn't show all the columns at first and maybe there is another way to displaying column names with specifications?...
    See more | Go to post

    Leave a comment:


  • That worked perfectly. Thank you. One more thing though that should be easily solved, yet I am still have difficulty with....

    I want to take this a step further and display certain columns when put under a specified query... a random example would be easiest to see what i mean...

    January
    Day Ticket Payment Guest
    1 yes no yes
    2 no yes...
    See more | Go to post

    Leave a comment:


  • cherryst152
    started a topic populating dropdown list with column names?
    in PHP

    populating dropdown list with column names?

    I keep getting problems with this. What i want to do is populate my dropdown list with the names of the columns in one of my database tables. Whatever i try to do i keep somehow filling it in with like 5 Array's or 5 Object's. Code is below and any help is greatly appreciated.

    $query33 = "SHOW COLUMNS FROM $January";
    $result33 = mysql_query($qu ery33);

    <select name='os1'>
    <?php
    ...
    See more | Go to post

  • cherryst152
    started a topic Passing selection box values
    in PHP

    Passing selection box values

    So I'm taking two simple selection boxes (select...optio ns), the whole shabang.

    What I want to do is test the values in these when someone is to select them. My problem is i want a simple way, I'm thinking a php if statement where i can test this. Example is below. There is much more complexity to this problem, but this would get me moving in the correct path.

    [code=html]
    <select name="list"><op tion...
    See more | Go to post
    Last edited by Atli; Nov 7 '07, 11:31 PM. Reason: Added [code] tags.
No activity results to display
Show More
Working...