elyfrank
-
Posts
45 -
Joined
-
Last visited
Posts posted by elyfrank
-
-
The thing is that I am doing this out of wordpress, it is a separate script running in the server.
Hey,
Thank you very much for all your help, I will try this out this afternoon and let you know if everything works ok.
-
How can I get the post_Id based on the meta_value? In this case meta_value is GF-1370?
Thank you
-
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
-
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);
-
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.343and 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'"; ?>
-
I just fix it. Thank you guys.
$result = mysql_query("UPDATE wp_usermeta SET meta_value='0' WHERE meta_key = 'wp_s2member_login_counter';")
-
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());
?> -
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
-
Requinix,
I used this
RedirectMatch (example-)*\.html$ http://www.example.com$1.html
And the output was:
www.example.com.html
At least it is recognizing the beginning of all my urls but I am missing something.
-
How can I do it with redirect match?
Thank you
-
The .htaccess and the files are in the same folder.
I know the htaccess is working because all the lines above and below that are doing what they suppose to do.
-
Nope, didn't work
-
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
-
Hi guys,
I have several urls that I would like to redirect using one line in my .htaccess
example:
http://www.example.com/example-1.html redirect to http://www.example.com/1.html
I just pretty much want to take out the beguining (example-) of multiple urls
Thank you very much.
-
Got it thanks
-
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.
-
Thank you Psycho, it worked great.
-
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.
-
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>
Thank you for your help!
-
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);
-
Great, that's exactly what I was looking for.
one more question: how do I echo does values without getting Array ( [0] (blue [1] => 0 [2] => 2 [3] => 2 [4]) etc etc
I would like to print is just like this blue1234
Thanks
-
I extracted the data fine with fgetcsv() function, the problem I am having is adding the values to the array so I can use them anyway I want.
-
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.
Thank you!
-
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.
Updating meta value in database mysql
in PHP Coding Help
Posted
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')";