Warning: Missing argument 2 for wpdb::prepare(), called in /home/usaha/public_html/wp-content/themes/huahin/functions/custom-functions.php on line 160 and defined in /home/usaha/public_html/wp-includes/wp-db.php on line 990
// get image id
// retrieves the attachment ID from the file URL
function get_image_id($image_url) {
global $wpdb;
$prefix = $wpdb->prefix;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts" . " WHERE guid='" . $image_url . "';")); // บรรทัด 160 ที่มีปัญหาครับ
return $attachment[0];
}
function comment_list( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
wp-db.php wp-db.php
function prepare( $query, $args ) { // บรรทัด 990 ที่มีปัญหาครับ
if ( is_null( $query ) )
return;
$args = func_get_args();
array_shift( $args );
// If args were passed as an array (as in vsprintf), move them up
if ( isset( $args[0] ) && is_array($args[0]) )
$args = $args[0];
$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
$query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
array_walk( $args, array( $this, 'escape_by_ref' ) );
return @vsprintf( $query, $args );
}