jump to navigation

PayPal Merchant Sevices Phone Number July 29, 2008

Posted by scoopseven in MediaPost.
add a comment

If you’re looking to call PayPal re: a Merchant Services or Payflow Pro account, here’s the direct number, so you don’t have to call India. 866-445-3167.

How to Dump and Import a Database or Table using the CLI on Linux July 8, 2008

Posted by scoopseven in Linux, MySQL.
1 comment so far

Log onto your server from the console or with a ssh client. I use Putty. Use the following command to dump a table.

myserver# mysqldump -u yourUserName -p yourDatabaseName yourTableName > yourDestinationFileName.sql

Use this command to dump a whole database (this may take a while). I’m using putting the dump file into a directory below too. Just to add to the example.

myserver# mysqldump -u yourUserName -p yourDatabaseName > /yourDestinationDirectory/yourDestinationFileName.sql

Because I’m moving this to another Linux DB server, I’m going to use scp to copy the file over

myserver# scp theFileIDumpedAbove.sql yourUserName@yourDestinationServer:/yourDestinationDir/yourDestinationFile.sql

Finally, on my destination server, where I just scp’ed the file to, I import my dump file into my database. If you’re replacing tables, make sure you drop those tables from the DB before you try to import them.

myserver# mysql -p yourDestinationDatabase < /yourSourceDirectory/yourSourceSqlFile.sql

Displaying PHP Variables in Quotes, Arrays July 2, 2008

Posted by scoopseven in PHP.
add a comment

Trying to output a variable without using dot (period) syntax. It’s much easier to output your variables within quotes. This code works:

while ($element = each( $query))
{ echo “my text” . $element[value][query_column] ; }

but I have a whole paragraph to format like this, so it’s really a PITA to write . myvar . “sometext” . myVar, etc. and get everything formatted correctly. Below are some things I tried before finding the solution below.

this code…

while ($element = each( $query))
{ echo “my text $element['value']['query_column']” ; }

throws this error (because of the single quotes):
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in Topmenu.php on line 113

and this code (single quotes removed):

while ($element = each( $query))
{ echo “my text $element[value][query_column]” ; }

displays “my text Array[query_column]” instead of the results in that query_column. Almost like I need a evaluate function or something.

Turns out that when you’re displaying the contents of an array within quotes, you need to wrap your variable in curly quotes. It’s always best to use single quotes around array indexes too. This is a little faster, as PHP doesn’t first look to see if the string has been defined as a constant, or is just a string index name. The final working code looks like this:

while ($element = each( $query))
{ echo “my text {$element['value']['query_column']}” ; }