Jump to content

elyfrank

Members
  • Posts

    45
  • Joined

  • Last visited

Posts posted by elyfrank

  1. I get this error: Error updating record: Table 'wordpress_i12dhflgoa.postmeta' doesn't exist

     

    Here is the code I am using:

    $sql="update `wp_pzvy_postmeta` set meta_value = '10' where meta_key = '_price' AND post_id=(select post_id from postmeta where meta_key = '_sku' and meta_value = 'GF-1370')";

  2. This is the table from myphpadmin. It looks like it got reformatted when I originally posted.

     

    meta_id        post_id         meta_key                meta_value

    18538            4356             _sku                          GF-1370

    18541            4356             _price                        2.343

  3. Hi,

    I changed the code a bit and tried to execute it and I am getting this error: Error updating record: Unknown column '_sku' in 'where clause'

    Here is the code

    <?php
    $servername = "localhost";
    $username = "username";
    $password = "password";
    $dbname = "myDB";
    $conn = mysqli_connect($servername, $username, $password, $dbname);
    // Check connection
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
     $sql="update `wp_pzvy_postmeta` set `_price` = 5 WHERE `_sku` = 'GF-1370'";
    
    if (mysqli_query($conn, $sql)) {
        echo "Record updated successfully";
    } else {
        echo "Error updating record: " . mysqli_error($conn);
    }
    mysqli_close($conn);
    
  4. Hi guys,

    I have a problem with my code.

    It connects with the database but it doesn't execute anything.

    I am trying to update a value in a table but I really don't know what I am doing wrong.

    I am trying to change the price based on the meta_value GF-1370

    Thank you very much.

     

    Here is Table (Taken from myphpadmin)

    meta_id  post_id  meta_key  meta_value

    18538 4356 _sku GF-1370 18541 4356 _price 2.343

     

    and here is my code:

     <?php 
    $link = mysql_connect('server', 'username', 'password'); 
    if (!$link) { 
        die('Could not connect: ' . mysql_error()); 
    } 
    echo 'Connected successfully'; 
    mysql_select_db(wordpress_i12dhflgoa);
    $sql="update `wp_pzvy_postmeta` set `_price` = 5 WHERE `_sku` = 'GF-1370'";
    ?>  
  5. Hi guys,

    I know a little bit of PHP but I am very new to mysql.

    How do I change the value (meta_value) of all the wp_s2member_login_counter in this table (wp_usermeta) using php?

    Thank you very much!

    This is what I got so far:

    <?php
    // Connect to MySQL
    $link = mysql_connect('mywebsite.com', 'wrd6rEDgggy', 'password');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    echo 'Connected successfully';
    mysql_select_db(wrd_47io4f3a6l);

    $result = mysql_query("UPDATE wp_usermeta SET wp_s2member_login_counter='0'")
    or die(mysql_error());  

    ?>

    post-78656-0-68685100-1363827290_thumb.jpg

  6. Hi guys,

    I managed to write this script to open a link in internet explorer close it and open another one.

    I would like to have all my links in a different txt files with multiple links line by line and be able to do the same function reading it from the bat file

     

    I will appreciate anybody that can help me with this.

    This is the bat file I made which works great. It opens these two llinks one at a time and do some stuff.

     

    @echo off

    start /MIN iexplore.exe www.website1.com

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    tskill iexplore /A

    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

    start /MIN iexplore.exe www.website2.com

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    ping 192.178.1.1 -w 1

    tskill iexplore /A

    RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

     

    Thank you very much

  7. Requinix,

    Thank you for the quick response, however for some reason this is not working for me. (it doesn't redirect)

    this is my htaccess code

     

    Options +FollowSymLinks

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]

    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

    RewriteEngine on

    RewriteRule ^example-(\d+)\.html$ /$1.html [L,R]

    addtype application/x-httpd-php .html

    AddHandler x-httpd-php .html

    AddType application/x-shockwave-flash .swf

  8. Psycho,

    I am sorry to bother you.

    How can I extract this text using preg_match_all? Where Read all reviews from  is the beguining and ') is the end?  'Read all reviews from text-to-extract')

    I having trouble with the delimiters.

     

    This is what I got so far: preg_match_all("#Read all reviews from \('([^']')*)#", $text, $matches);

     

    but is not working.

     

    Thank you very much.

  9. Hi guys,

    I hope you guys are having a terrific day.

    I am trying to get some data from a page using preg_match an place it in an array.

     

    This is the PHP code I got so far:

     

    <?php

    $url = "http://www.examplepage.html";

    $raw = file_get_contents($url);

    preg_match("/<ul class='Codes'>(.*)<\/ul>/isU",$raw,$output);

    echo $output[1];

    ?>

     

    I am able to read all text between <ul class='Codes'></ul> which is the one I am showing below.

     

    Result from PHP code above:

     

    <li><script type='text/javascript'>Code.number('4.236173.USD.EN.057880560561287921.386595955', '')</script><img src='/Images/providers/logos/Logo1.gif?cdn=040309' alt='' /> <script type='text/javascript'>Code.number('4.236173.USD.EN.057880560561287921.386595955', 'Read all codes from Number1')</script></li><li><script type='text/javascript'>Code.number('4.1957403.USD.EN.057880560561287921.458090474', '')</script><img src='/Images/providers/logos/logo2.gif?cdn=040309' alt='' /> <script type='text/javascript'>Code.number('4.1957403.USD.EN.057880560561287921.458090474', 'Read all codes from Number2')</script></li><li><script type='text/javascript'>Code.number('4.4801652.USD.EN.057880560561287921.1469771421', '')</script><img src='/Images/providers/logos/Logo6.gif?cdn=040309' alt='' /> <script type='text/javascript'>Code.number('4.4801652.USD.EN.057880560561287921.1469771421', 'Read all codes from Number3')</script></li>

     

     

     

    This is what I would like to do:

     

    Count how many times Code.Number happens.

    and then for each of then capture and place in array the code number between the ' '. (the first example will be 4.236173.USD.EN.057880560561287921.386595955) and so on.

     

    Code Numer 0,1 = 4.236173.USD.EN.057880560561287921.386595955

    Code number 0,2= Logo1.gif

     

    Code number 1,1 = 4.1957403.USD.EN.057880560561287921.458090474

    code number 1,2=Logo2.gif

     

    and so on.

     

    Thank you very much.

  10. The title tag works fine in Firefox, but the alt tag or title tag doesn't work in ie.

     

    This is my iframe in file1.html

     

    <iframe src="file1.php" frameborder="0" scrolling="no" width="560" height="390" marginheight="0px" marginwidth="0px"></iframe>

     

    and this is the form inside file1.php

     

    <form action="file2.php" method="get">

    input type="submit" name="button" id="button" value="Results" alt="bla bla bla" Title="See bla bla bla"  />

      </form>

    :confused:

    Thank you for your help!

  11. Hey sasa,

    How do I compare and sort this array?

    I am adding a new value at the end of the arrays like this

    $colors[$i][repeat]=$x;

    After I added the value I would like to compare and sort the array base on that value

    I have something like this so far and it is not working:

    function compare($x, $y)

    {

    if ( $colors[repeat] == $colors[repeat] )

      return 0;

    else if ( $colors[repeat] < $colors[repeat] )

    return -1;

    else

      return 1;

    }

     

    uasort($colors, 'compare');

    print_r($colors);

     

  12. Hi guys,

    This is my problem:

    I have a csv file let's say have these values:

     

    blue,1,2,3,4

    red,8,5,6,7

     

    I need to add thes values into a 2d array

    to be able to use like this:

    colors[1][2]=2

    colors[2][4]=7

     

    Where my first number is the row and the second number is the value within that row.

     

    This is what I got so far

     

    <?PHP

    $i=0;

    $j=0;

    $file_handle = fopen("color-list.csv", "r");

    while (!feof($file_handle) )

    {

    $colors = fgetcsv($file_handle, 10000);

     

    for ($j=0; $j<=4; $j++)

    {

    $row[$i][$j]=$colors[$j];

                                            print row[$i][$j];

    }

    $i++;

    ?>

     

    For some reason this doesn't work. Maybe I am declaring the arrays wrong. :confused:

     

    Thank you!

  13. All I want is to be able to read a file until I find a word.

    This is the code I wrote:

     

    <?php

    $word="blah";

    $i=0;

    $myFile = "http://www.example.com/file.txt";

    $handle = fopen($myFile, 'r');

    while($Data<>$word)

    {

    fseek($handle, $i+1);

    $i=$i+1;

    $Data = fread($handle, 4);

    }

    if ($Data = $word) echo $Data;

    fclose($handle);

    ?>

     

    And this is the error I am getting: "Warning: fseek() [function.fseek]: stream does not support seeking in ...." I keep getting this error repeatedly until it finds the word and print it.

     

     

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