dynamic page using php from sql database

I managed to fix this myself with the following <?php if (isset($_GET[‘id’])) { $id = $_GET [‘id’]; } else { $id = “”; } //$url = “http://18.168.90.222/device-repair-service/device?id=$id”; require ‘sql_connect.php’; try { $connection = new PDO($dsn, $username, $password); $connection -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //echo “connection succesful”; } catch (PDOException $error){ echo $error -> getMessage(); } //prevent SQL … Read more

Why doesn’t PhotoSmash plugin play well with wp_query?

There is no need to juggle $wp_query object, store it in temp, etc. It is rarely good idea to directly mess with important global variables, unless you absolutely need to. You can just create your own arbitrary variable and init it with new WP_query $some_variable = new WP_Query($args); and so on. Also don’t forget to … Read more

$_GET[‘updated’] does not work in WordPress 3.1?

This line is wrong, i couldn’t even get the theme options page up without changing it.. add_theme_page( “Satoshi Theme Options”, “Theme Options”, 8, __FILE__, ‘theme_options_admin’); Update that to read something like.. add_theme_page( “Satoshi Theme Options”, “Theme Options”, 8, ‘satoshi-theme-options’, ‘theme_options_admin’); Saving options did produce the updated message as expected. UPDATE: Looks like the $_GET key … Read more

How do you create two separate Register pages?

Basically all you need to do is add an hidden field named role and set the value to whatever role you want on the register form. add_action(‘register_form’,’show_role_field’); function show_role_field(){ ?> <input id=”role” type=”hidden” tabindex=”20″ size=”25″ value= “<?php if (isset($_GET[‘role’])){echo $_GET[‘role’];} ?>” name=”role”/> <?php } Next thing is to register that role when the user has … Read more