Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Posts posted by techker

  1. <?php
    mysql_connect("localhost", "user_techker", "pass");
    mysql_select_db("soul3438_gymgraphtrainers");
    $showtablequery = "SHOW TABLES FROM soul3438_gymgraphtrainers";
    
    $showtablequery_result  = mysql_query($showtablequery);
    while($showtablerow = mysql_fetch_array($showtablequery_result))
    {
            echo $showtablerow[0]."<br />";
    }
    
    ?>
    

     

    All good thx!!

  2.  

     

    <? mysql_connect("localhost", "user_techker", "pass");
    mysql_select_db("soul3438_gymgraphtrainers");
    $showtablequery = "SHOW TABLES FROM [soul3438_gymgraphtrainers]";
    
    $showtablequery_result  = mysql_query($showtablequery);
    while($showtablerow = mysql_fetch_array($showtablequery_result))
    {
            echo $showtablerow[0]."<br />";
    }
    
    ?>

  3. <?
    $showtablequery = "SHOW TABLES FROM [your database name here]";
    
    $showtablequery_result  = mysql_query($showtablequery);
    while($showtablerow = mysql_fetch_array($showtablequery_result))
    {
            echo $showtablerow[0]."<br />";
    }
    
    ?>

     

    try it like that if you like, that may you dont have to worry about assigning your connection, just put your database name in the right place

     

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'soul3438'@'localhost' (using password: NO) in /home/soul3438/public_html/Gymgraph/show.php on line 4

     

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/soul3438/public_html/Gymgraph/show.php on line 4

     

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/soul3438/public_html/Gymgraph/show.php on line 5

  4. hey guys is it possible to do this?

     

    like(cause i can't explain the srting if it is the real name..lol)

     

    link :http://site.ca/admin/GymGraph/grapht.php?id=4,trainer=mike

     

     

    $trainer= mysql_escape_string($_GET['trainer']); 
    $id = mysql_escape_string($_GET['id']); 
    
    $sql = "SELECT *  
    FROM `$trainer`  
    WHERE `id`= $id"  
    ; 
    $res= mysql_query($sql); 
    $row= mysql_fetch_assoc($res);?>  
    

     

    i changed it to

     

    mysql_real_escape_string  and still nothing.

     

    it is as soon as i pass 2 infor in the link it does not work..

     

     

  5. hey guys i was wondering if somebody can point me in the write direction for this.

     

    im looking for a script or tutorial that has a list box that i will populate with mysql data that conatins images.when you select the image name the script shows the image..

     

    so list box to select an image that will show it.lol

  6. hmm..it is true that the members can share the rss links but just like there username and password of there account.but anywyas other people can't take advantage of there promotions.

     

    si it is interesting cause he can even broadcast if h eis closed or holidays..

     

     

    how do i get this set up?i have googled rss feed tutorials but i get about 50 pages of sites..

     

    i juste need a script that he can write the news and the scirpt that the clients use and a widget??

  7. Hey guys  i have a quick question concerning what is RSS

     

    i have my budy that has a members only promotion section on his site.now if it's what i think it is(RSS)it can send information to rss feed about anything(promotions) the client justs need too subscribe to it or download a widget..

     

    is that write?or is this public meaning that it will broadcast to all ...

     

    and if it's what i think were do i start with this..lol

  8. What do you mean you cant view the source?  Every internet browser lets you view the source of webpages you are browsing.

     

    There is no reason that this line in your code should not work (but notice I changed it up a bit):

     

    <?php
    $imcolumn .= '<tr><td><img src="?pid='.$row[pid].'" width="144" /><br />';
    

     

    However, the image will be distorted since you are not setting the height as well.

     

    it does not work the code is wrong.?

  9. strange i copied that from a page i have it working fine on.

     

    to add to what gavin said "" will probaly just out the 144 and not use the rest of the string, try width='144' in stead

    or even width=".144." might do the job or have you thought of giving the images an id then use css to resize.

     

    maybe it does work but i can't seem to figure it out in my script..

     

    if it try ".144." it gives me an error and the other nothing?

  10. function scale_image($p,$mw='',$mh='') { // path max_width max_height
        if(list($w,$h) = @getimagesize($p)) {
        foreach(array('w','h') as $v) { $m = "m{$v}";
            if(${$v} > ${$m} && ${$m}) { $o = ($v == 'w') ? 'h' : 'w';
            $r = ${$m} / ${$v}; ${$v} = ${$m}; ${$o} = ceil(${$o} * $r); } }
        return("<img src='{$p}' alt='image' width='{$w}' height='{$h}' alt='Click to view this members profile' style='margin-top:3px;' />"); }
    }

     

    then where you what the picture use

     

    echo scale_image('imageURL',w,h); // change w to the max width and h to the max height in px ie scale_image('image.png',100,120) it scales the image to 

     

    i havn't looked into using in your code but it might help

     

    this is not working for me..thx

  11. Check your page source once the code is run. Somewhere you should see the img tag if its all worked properly.

     

    <img src="you.image" width=144  >

     

    I'm guessing you want a standard width, so that the height can change. If you see the width=144 and it still doesn't work try complying to XHTML standards;

     

     

     

    <img src="you.image" width="144"  />

     

    the image is ain a variable

     

    $imcolumn .= "<tr><td><img src=?pid=$row[pid] width=144 ><br>";

     

    <b><?= $imcolumn ?></table></center>

     

    it is that im using? but i will try with the ""

  12. hey guys my script calls a picture in my database.they only thing is i need to resize it but it does not seem to work?

     

    pics.php?pid=3

     

    // Connect to database 
    
    $errmsg = "";
    if (! @mysql_connect("localhost","here","there")) {
    $errmsg = "Cannot connect to database";
    }
    @mysql_select_db("techker_here");
    // Find out about images to display 
    $pid = mysql_escape_string($_GET['pid']);
    if ($_GET['pid']) { 
       $whereclause = "where pid = \"$pid". 
          $_GET['pid']. 
          "$pid\""; 
       $gotten = @mysql_query("select * from pix  order by pid desc "); 
       while ($row = @mysql_fetch_assoc($gotten)) { 
          $imcolumn .= "<tr><td><img src=?pid=$row[pid] width=144 ><br>"; 
          $imcolumn .= htmlspecialchars($row[title])."</td></tr>"; 
          $nim++; 
       } 
       if (! $nim) $imcolumn = "<tr><td>No matching images</td></tr>"; 
    } else { 
       $imcolumn .= "<tr><td>Images will appear here</td></tr>"; 
    } 
    
    // If this is the image request, send out the image 
    
    if ($_GET['pid']) { 
       $gotten = @mysql_query("select * from pix where pid = $_GET[pid]"); 
       $row = mysql_fetch_assoc($gotten); 
       $bytes = $row[imgdata]; 
       header("Content-type: image/jpeg"); 
       print $bytes; 
       exit (); 
       } 
    
    ?> 
    
    <html><head> 
    <title>Selection of up to 3 images from a database</title> 
    <body bgcolor=white><h2> </h2> 
    <font color=red><?= $errmsg ?></font> 
    <center><table border=1> 
    <b><?= $imcolumn ?></table></center> 
    <hr> 
    </body> 
    </html> 
    

     

  13. hey guys i found this script to insert images in a mysql database.

     

    works good for inserting but getting the image is wrong..i know about were it is wrong but i can't see to correct it??

     

    <?php
    
    // Connect to database
    
    $errmsg = "";
    if (! @mysql_connect("localhost","techker","pass")) {
    $errmsg = "Cannot connect to database";
    }
    @mysql_select_db("techker_DB");
    
    // First run ONLY - need to create table by uncommenting this
    // Or with silent @ we can let it fail every sunsequent time ;-)
    
    $q = <<<CREATE
    create table pix (
    pid int primary key not null auto_increment,
    title text,
    imgdata longblob)
    CREATE;
    @mysql_query($q);
    
    // Insert any new image into database
    
    if ($_REQUEST[completed] == 1) {
    // Need to add - check for large upload. Otherwise the code
    // will just duplicate old file ;-)
    // ALSO - note that latest.img must be public write and in a
    // live appliaction should be in another (safe!) directory.
    move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img");
    $instr = fopen("latest.img","rb");
    $image = addslashes(fread($instr,filesize("latest.img")));
    if (strlen($instr) < 149000) {
    mysql_query ("insert into pix (title, imgdata) values (\"".
    $_REQUEST[whatsit].
    "\", \"".
    $image.
    "\")");
    } else {
    $errmsg = "Too large!";
    }
    }
    
    // Find out about latest image
    
    $gotten = @mysql_query("select * from pix order by pid desc limit 1");
    if ($row = @mysql_fetch_assoc($gotten)) {
    $title = htmlspecialchars($row[title]);
    $bytes = $row[imgdata];
    } else {
    $errmsg = "There is no image in the database yet";
    $title = "no database image available";
    // Put up a picture of our training centre
    $instr = fopen("../wellimg/ctco.jpg","rb");
    $bytes = fread($instr,filesize("../wellimg/ctco.jpg"));
    }
    
    // If this is the image request, send out the image
    
    if ($_REQUEST[gim] == 1) {
    header("Content-type: image/jpeg");
    print $bytes;
    exit ();
    }
    ?>
    
    <html><head>
    <title>Upload an image to a database</title>
    <body bgcolor=white><h2>Here's the latest picture</h2>
    <font color=red><?= $errmsg ?></font>
    <center><img src= width=144><br>
    <b><?= $title ?></center>
    <hr>
    <h2>Please upload a new picture and title</h2>
    <form enctype=multipart/form-data method=post>
    <input type=hidden name=MAX_FILE_SIZE value=150000>
    <input type=hidden name=completed value=1>
    Please choose an image to upload: <input type=file name=imagefile><br>
    Please enter the title of that picture: <input name=whatsit><br>
    then: <input type=submit></form><br>
    <hr>
    
    </body>
    </html>
    
    

     

    the error

    <html><head>
    <title>Upload an image to a database</title>
    <body bgcolor=white><h2>Here's the latest picture</h2>
    <font color=red><?= $errmsg ?></font>
    <center><img src= width=144><br>
    <b><?= $title ?></center>
    

     

    i think there is missing info on the image it self?

    img src= HERE width=144

     

    thanks!!

×
×
  • 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.