• UPDATED TO FIVE STARS: FIXED my own code; SEE COMMENTS in three star section — Alex. Use mysqli, not mysql.

    This widget is great for simple php code and I recommend it. But I get mixed and even inconsistent results making read or write calls to my hosted server mysql database. I’m using the twentyeleven theme.

    The same script that executes great in a standalone test.php in my browser may run in a PHP Code Widget, or it may run OK but break the sidebar below the insertion point, or it may not run at all.

    A single database call seems to work better than multiple calls in the same script or multiple scripts in successive PHP Code widgets.

    In fairness, I’ve been coding in Perl and mysql for years (very helpful) but I’ve only been picking up PHP more recently. I can provide code samples, but not sure this is the right forum for that.

    Any common experience, comment or suggestions? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter summitlake

    (@summitlake)

    FIVE STARS: UPDATE: I split 3 queries into three different PHP Code widgets with tweaked code. They then worked at the bottom of the sidebar. I moved them to the top where they belong. They still worked, but they broke the stock CATEGORIES and ARCHIVES popups, and most sidebar content below that.

    BUT IT GETS BETTER. I rewrote all 3 to use mysqli connects and queries, rather than the older mysql.

    All works fine now. I don’t know what API the author uses, but I found that my older mysql PHP calls are deprecated. People are now using the preferred APO and mysqli protocols.

    I’m upgrading my rating to 5 stars if I can find the right way to do it.

    Plugin Author Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The PHP Code widget doesn’t attempt to parse your PHP Code at all. It just runs it. If you have any sort of error, the error is in your own code, the widget doesn’t discriminate or attempt to “fix” your code in any way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Good, but problems with myysql scripts’ is closed to new replies.