Jump to content

nadeemshafi9

Members
  • Posts

    1,245
  • Joined

  • Last visited

Posts posted by nadeemshafi9

  1. SUBSTR_INDEX and REPLACE have been part of mysql since day dot.

     

    No need for multiple queries, php loops and especially any ereg* functions.

     

    i knew you were gona say that , yeh cool like you said but at least he has more than one choice

     

    i agree with you thorpe it will make it slower using ereg

  2. this will work if ur mysql dosent have that function or if u are finding it hard

    <?php
    mysql_connect("localhost", "user", "pass") or die(mysql_error());
    mysql_select_db("dbname") or die(mysql_error());
    
    $result = mysql_query("SELECT * FROM video") or die(mysql_error());
    
    while($row = mysql_fetch_array( $result )){
         $title_altered = ereg_replace("\-", "", $row['full_video_name']);
         mysql_query("UPDATE video SET title='".$title_altered .", ' WHERE VID='".$row['id']."'")
         or die(mysql_error());
    }
    ?>
    

    you have an error in the above code here:

     

    le='".$title_altered .", ' WHE

     

    look at the ' ' its after the , eg '".$title_altered .", '

     

    it should be '".$title_altered ."' ,

     

    plus teh first one and second one are different chars one is a top tick and one is a single quote  ' ' but it wont show on myh machine

     

     

    use this

     

    <?php
    mysql_connect("localhost", "user", "pass") or die(mysql_error());
    mysql_select_db("dbname") or die(mysql_error());
    
    $result = mysql_query("SELECT * FROM video") or die(mysql_error());
    
    while($row = mysql_fetch_array( $result )){
         $title_altered = ereg_replace("\-", "", $row['full_video_name']);
         mysql_query("UPDATE video SET title='".$title_altered ."', WHERE VID='".$row['id']."'")
         or die(mysql_error());
    }
    ?>
    

    you need to sort this bit out

     

    WHERE VID='".$row['id']."'")

     

    its either WHERE id='".$row['id']."'")

     

    or

     

    WHERE VID='".$row['VID']."'")

     

    you need to check what its called in the db

     

     

    also same for  mysql_query("UPDATE video SET title='".$title_altered .", ' WHERE VID='".$row['id']."'")

     

    the feild title is it title or video title you need to check in the db

     

    whatever is in row will be the name of teh feild eg row['video_title'] exactly like in teh db or row['title'] if its that, if u whant tgo set it it should be the name in the db not any random name video_title = 'blah' if thats what it is in the db

  3. No need for loops, or indeed php at all. Should be able to get this done with a simple query.

     

    UPDATE video SET title = REPLACE(SUBSTRING_INDEX(full_video_name, '.', 1), '-', ' ');

     

    nice function dude, but if he dosent have teh correct myhsql version he can use

     

    pseudo

     

    while mysql = fetch row {

    title = get the title

     

    new title = ereg_replace(-, '', title)

     

    update the record where id = row[id]

     

    }

  4. you shouldent store the path i do this every day so trust me, you should generate a random number on each image when its uploaded and also append its title to the image name and the extension, you can then use this image name from anywhere in your site by appending the correct path after you retrieve the image name from the db, storing the whole path limits you plus it wont work on Linux if ur using c: and all that.

     

     

    echo ("<img src = ../images/" . $row["bookcover"] . ">");

     

     

     

     

    echo ("<img src = ../img/" . $row["bookcover"] . ">");

     

     

     

    echo ("<img src = /thumb/small/" . $row["bookcover"] . ">");

     

    infact you can save teh same image in different places using teh same name and only need to store the name once in teh record, these different images can be made different sizes using teh GD library and u only have one name for all of them the differenc eis there in different places.

     

     

    here is how you get the name

     

    if($_FILES['drawings_gif']['size'] > 0) {

    $gif_name = $_FILES['drawings_gif']['name'];

    $gif_fullstop = strrpos($gif_name, ".");

    $ext = strtolower(substr($gif_name, $gif_fullstop));

    $new_gif_name = strtolower($new_file_name.$ext);

    }

     

     

    you probably whant to php.net/ereg_replace all the spaces in teh name with and underscore and all the other non alpha chars and append the time to the image this means you never need to delte the image, just update the record with the new image with adifferent time and you can keep the old image.

  5. Although I imagine macs to be very popular for similar reasons as well:

     

    slip and slide

    when you cum from her neck to her hips, and you make her get on top of you and slide around.

     

    lol

    I don't like the dock, and the dock only shows the programs you have running in your foreground. The task manager shows all processes that are running on the entire system. Besides, this is also entirely irrelevant in terms of being superior for web development.

     

    you have no need to see windows processes, on a mac any process that is instantiated is displayed as an icon in the bottom dock.

     

    No, you don't know what you're talking about. Every process is certainly not displayed in the dock. Only the foreground processes.

     

    unlike XP indexing cant be turned off and constantly thrashes ur pc, my hard drive bust.

     

    Yes you can. Just disable the service or remove all the indexing locations. I know because I have actually done that.

     

    you can turn off indexing in both xp and vista, you cant turn off the process managment in vista (process managment constantly manouvers process state  in a new and more advanced way to and from teh disk in order to optamise ur machines performance) you cant disable it

  6. I'm not sure what "slip in/out" is supposed to mean, all the other operating systems are meant for work as well

     

    this means that the hardware of mac machines slips and slides out and in instead of wires and opening.

     

    My PC doesn't lose track of time. If yours does that then maybe the battery on your motherboard that died and needs to be replaced or something. I can also stay connected quite fine.

     

    obviously you havent studied ur networking properly, im chatting about pc based NIC LAN FRAME clock carried throgh the message for syncronisation.

     

    I don't like the dock, and the dock only shows the programs you have running in your foreground. The task manager shows all processes that are running on the entire system. Besides, this is also entirely irrelevant in terms of being superior for web development.

     

    you have no need to see windows processes, on a mac any process that is instantiated is displayed as an icon in the bottom dock.

     

    You're undermining your own argument, dude. If you say that Windows is more secure, then a Mac would obviously not be superior. Moreover, Firefox can run on all platforms, and whether you think the usability of a Mac is better is purely subjective.

     

    true there is more harmfull software out there for windows rather than mac, but the fact is that windows patches things even if they cause display glitches in there browser and breaks the DOM or even if the operating system is made less usable.

     

     

  7. I think he's claiming a "mac" is a superior platform for Web development. In other words, talking gibberish.

     

    im not sugesting, im proof that a mac is the best environment for web development with lamp, they recently made this new function u just highligfht the file and press space bar and it opens in in a text editor that is super fast to open instant and u click away from it it closes and saves, if u wack ur mouse into the corner all the windows are nicley tiles and then u click one and it comes to the front, MAC and Firefox are superior environments for web development using any editor.

     

    How does that prove that Mac is superior to Windows and/or GNU/Linux for web development? I have no need for the features you listed at all.

     

    And could you try to write in English instead? That'll make it easier to read your posts.

     

    it simpley just dosent flow properly in windows, the effect they created with the windows is a wana be of the mac osx hot corner tyling, it just dosent flow, belive me give it a go and u will fall in love with it, the mac itself is a work of art and is solid build. ok if u are an enthusiast for upgrading to teh latest components then maybe not but for work purposes literaly everything on the mac machnines slip in and slide out, these machines are made for work. and i cant even begin to tell you about there networking capability compared to a pc, pc's loose track of there clock somtimes and loose connection this never hapens on macs. i have a pc windows based here right next tio me i only use it for testing ie 6 and 7 or if i realy need it, i know windows and ie are much more secure but the usability of a mac and firefox a`re amazing.

     

    in windows machines if u drag and drop a file into a window and u have that window open on another windows machine using networks, that file wont display instantly thats why they have a REFRESH button everywhere in wondows, there is no such thing as refresh on a mac osx machine everything happens like it should.

  8. I think he's claiming a "mac" is a superior platform for Web development. In other words, talking gibberish.

     

    im not sugesting, im proof that a mac is the best environment for web development with lamp, they recently made this new function u just highligfht the file and press space bar and it opens in in a text editor that is super fast to open instant and u click away from it it closes and saves, if u wack ur mouse into the corner all the windows are nicley tiles and then u click one and it comes to the front, MAC and Firefox are superior environments for web development using any editor. The mac environment in terms of usability is light years ahead of windows, windows just has 1 and only 1 thing which is the right drag drop menu that is superior. textboxes on a mac in any application system or web are automaticaly spell checked. its soo good i dont even biother using it, this box right here is spell checked i know exactly where my mistakes are i just dnt bother. I used windows for years and i still love it at home i use windows connected to my xbox 360 and 4 other windows machines in the house all networked and fire walled with zone alarm, i am a fan of windows, but u cant escape the fact that i been using mac for 2 years now at work and it is so much easier to use for this work compared to trying to do the same stuff at home on my pc windows both using dreamweaver.

  9. just look at the methods of the $row-> class and break it down ur gona have to get intimate with it, how long have u been working with php professionaly ?

     

    If $row is coming from the database it was probably retrieved with mysql_fetch_object not third party at all just a different way of pulling data out of the database.

     

    im just sugesting this may be the freamwork Model component of the MVC in place so it would be good to know it and use it in ur own code like it was made to do rather than revert to basic php which would be a waste of the nice work done by the previouse programmer.

  10. nice

    Thanks everyone, I figured it out, my original try of using this:

    <?php
        if ($row->AddEditAdmin == "YES") {
    ?>    

     

    Did end up working, the problem was that my query had ended on the page (does that make sense) because when I moved that chunk of menu options up on the page, it worked, but at the bottom of the menu (after a chunk of code that uses a different query) this chunk didn't work, so I just went with the rearrange and now I can try and figure out why the one query didn't continue to work, can queries not be nested on a page?

     

    is this a third part software that u are modifying ?

  11. convoluted ?, yes maybe but it works watchu sayin ?

     

    because it's a MUCH less efficient way of doing in_array()

     

    its much more extendibale, u can connect and stuff to db or somthing interesting if not stick with the simple if or || hein lol i thoght u were gona show me a one liner to make my code look crap i was worried there lol

  12. Yes, you could do that. But why on earth would you? That's one of the most convoluted pieces of code i've seen in my life

     

    Edit: Actually i lied. You couldn't do that. That would only check to see if $row->AdminID was 20, since your variable $isitin is overwritten every time.

     

    quote true but its nearly there here u go

     

     

    <?php
        $nums = array("3", "24", "20");
        $isitin = 0;
        foreach($nums as $num) if(ereg($num, $row->AdminID )) $isitin = 1;
    
        if ($isitin) {
    ?>   
        <tr>
            <td><div class="admin_link"><a href="AddAdmin.php?AdminID=<?php echo $AdminID; ?>" target="mainFrame">Add Admin</a></div></td>
        </tr>
        <tr>
            <td><div class="admin_link"><a href="ViewAdmin.php?AdminID=<?php echo $AdminID; ?>" target="mainFrame">View Admin</a></div></td>
        </tr>
    <?php
        }
    ?>
    

  13. u could do this

     

    <?php
    $nums = array("3", "24", "20");
    foreach($nums as $num) {
        if(ereg($num, $row->AdminID )) $isitin = 1;
        else $isitin = 0;
    }
    
        if ($isitin) {
    ?>   
        <tr>
            <td><div class="admin_link"><a href="AddAdmin.php?AdminID=<?php echo $AdminID; ?>" target="mainFrame">Add Admin</a></div></td>
        </tr>
        <tr>
            <td><div class="admin_link"><a href="ViewAdmin.php?AdminID=<?php echo $AdminID; ?>" target="mainFrame">View Admin</a></div></td>
        </tr>
    <?php
        }
    ?>
    

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